You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@batchee.apache.org by rm...@apache.org on 2014/01/17 20:17:26 UTC

[1/2] git commit: fixing diagram generation (root/sink colors...) + few pom reformatting + BATCHEE-5 metrics for partitionned steps

Updated Branches:
  refs/heads/master b6e56b923 -> 822b3df21


fixing diagram generation (root/sink colors...) + few pom reformatting + BATCHEE-5 metrics for partitionned steps


Project: http://git-wip-us.apache.org/repos/asf/incubator-batchee/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-batchee/commit/1d1f1161
Tree: http://git-wip-us.apache.org/repos/asf/incubator-batchee/tree/1d1f1161
Diff: http://git-wip-us.apache.org/repos/asf/incubator-batchee/diff/1d1f1161

Branch: refs/heads/master
Commit: 1d1f1161a0c15928759b11a8696799ee5237dade
Parents: b6e56b9
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Fri Jan 17 19:38:33 2014 +0100
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Fri Jan 17 19:38:33 2014 +0100

----------------------------------------------------------------------
 gui/pom.xml                                     |   2 +-
 gui/servlet/pom.xml                             | 416 ++++++++++++-------
 .../impl/controller/BaseStepController.java     |   2 +-
 .../controller/PartitionedStepController.java   |  13 +-
 .../test/metric/PartitionMetricsTest.java       |  82 ++++
 .../META-INF/batch-jobs/partition-metrics.xml   |  30 +-
 .../apache/batchee/tools/maven/DiagramMojo.java |  33 +-
 .../batchee/tools/maven/DiagramMojoTest.java    |   4 +-
 .../resources/META-INF/batch-jobs/diagram.xml   |   4 +-
 9 files changed, 415 insertions(+), 171 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/1d1f1161/gui/pom.xml
----------------------------------------------------------------------
diff --git a/gui/pom.xml b/gui/pom.xml
index c6c41d4..a1c00f8 100644
--- a/gui/pom.xml
+++ b/gui/pom.xml
@@ -144,6 +144,6 @@
     <properties>
         <arquillian.version>1.0.3.Final</arquillian.version>
         <cxf.version>2.6.9</cxf.version>
-        <tomcat.version>7.0.42</tomcat.version>
+        <tomcat.version>7.0.50</tomcat.version>
     </properties>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/1d1f1161/gui/servlet/pom.xml
----------------------------------------------------------------------
diff --git a/gui/servlet/pom.xml b/gui/servlet/pom.xml
index 5835155..d3e4391 100644
--- a/gui/servlet/pom.xml
+++ b/gui/servlet/pom.xml
@@ -18,171 +18,275 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
+  <modelVersion>4.0.0</modelVersion>
 
-    <parent>
-        <artifactId>batchee-gui</artifactId>
-        <groupId>org.apache.batchee</groupId>
-        <version>0.1-incubating-SNAPSHOT</version>
-    </parent>
+  <parent>
+    <artifactId>batchee-gui</artifactId>
+    <groupId>org.apache.batchee</groupId>
+    <version>0.1-incubating-SNAPSHOT</version>
+  </parent>
 
-    <artifactId>batchee-servlet</artifactId>
-    <name>BatchEE :: GUI :: Servlet</name>
+  <artifactId>batchee-servlet</artifactId>
+  <name>BatchEE :: GUI :: Servlet</name>
 
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jbatch_1.0_spec</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-servlet_3.0_spec</artifactId>
-        </dependency>
-        <dependency>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jbatch_1.0_spec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-servlet_3.0_spec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jaxrs_1.1_spec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-atinject_1.0_spec</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.batchee</groupId>
+      <artifactId>batchee-jbatch</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.shrinkwrap.descriptors</groupId>
+      <artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.shrinkwrap.resolver</groupId>
+      <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.arquillian.junit</groupId>
+      <artifactId>arquillian-junit-container</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.arquillian.protocol</groupId>
+      <artifactId>arquillian-protocol-servlet</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.arquillian.container</groupId>
+      <artifactId>arquillian-tomcat-embedded-7</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tomcat.embed</groupId>
+      <artifactId>tomcat-embed-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tomcat.embed</groupId>
+      <artifactId>tomcat-embed-jasper</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tomcat.embed</groupId>
+      <artifactId>tomcat-embed-logging-juli</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jdt.core.compiler</groupId>
+      <artifactId>ecj</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>net.sourceforge.htmlunit</groupId>
+      <artifactId>htmlunit</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.4</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin> <!-- use mvn tomcat7:run  -->
+        <groupId>org.apache.tomcat.maven</groupId>
+        <artifactId>tomcat7-maven-plugin</artifactId>
+        <version>2.2</version>
+        <configuration>
+          <ignorePackaging>true</ignorePackaging>
+          <path>/</path>
+          <warSourceDirectory>${project.basedir}/src/main/resources/META-INF/resources</warSourceDirectory>
+          <additionalClasspathDirs>
+            <additionalClasspathDir>${project.build.directory}/${project.build.finalName}.${project.packaging}
+            </additionalClasspathDir>
+            <additionalClasspathDir>${project.build.directory}/${project.build.finalName}-tests.${project.packaging}
+            </additionalClasspathDir>
+          </additionalClasspathDirs>
+        </configuration>
+        <dependencies>
+          <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-core</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+          <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-util</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+          <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-coyote</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+          <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-api</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+
+          <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-jdbc</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+
+          <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-dbcp</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+
+          <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-servlet-api</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+
+          <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-jsp-api</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+
+          <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-jasper</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+
+          <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-jasper-el</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+
+          <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-el-api</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+
+          <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-catalina</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+
+          <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-tribes</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+
+          <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-catalina-ha</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+
+          <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-annotations-api</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+
+          <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-juli</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+
+          <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-logging-juli</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+          <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-logging-log4j</artifactId>
+            <version>${tomcat.version}</version>
+          </dependency>
+
+          <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jaxrs_1.1_spec</artifactId>
-        </dependency>
-        <dependency>
+            <artifactId>geronimo-atinject_1.0_spec</artifactId>
+            <version>${atinject.version}</version>
+          </dependency>
+          <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-atinject_1.0_spec</artifactId>
-        </dependency>
-
-        <dependency>
+            <version>${atinject.version}</version>
+          </dependency>
+          <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jbatch_1.0_spec</artifactId>
+            <version>${batch-api.version}</version>
+          </dependency>
+          <dependency>
+            <groupId>com.fasterxml.jackson.jaxrs</groupId>
+            <artifactId>jackson-jaxrs-json-provider</artifactId>
+            <version>${jackson.version}</version>
+          </dependency>
+          <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-frontend-jaxrs</artifactId>
-        </dependency>
-        <dependency>
+            <version>${cxf.version}</version>
+            <exclusions>
+              <exclusion>
+                <groupId>com.sun.xml.bind</groupId>
+                <artifactId>jaxb-impl</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.apache.geronimo.specs</groupId>
+                <artifactId>geronimo-javamail_1.4_spec</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.apache.ws.xmlschema</groupId>
+                <artifactId>xmlschema-core</artifactId>
+              </exclusion>
+              <exclusion>
+                <groupId>org.codehaus.woodstox</groupId>
+                <artifactId>woodstox-core-asl</artifactId>
+              </exclusion>
+            </exclusions>
+          </dependency>
+          <dependency>
             <groupId>org.apache.batchee</groupId>
             <artifactId>batchee-jbatch</artifactId>
             <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.shrinkwrap.descriptors</groupId>
-            <artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.shrinkwrap.resolver</groupId>
-            <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.arquillian.junit</groupId>
-            <artifactId>arquillian-junit-container</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.arquillian.protocol</groupId>
-            <artifactId>arquillian-protocol-servlet</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.arquillian.container</groupId>
-            <artifactId>arquillian-tomcat-embedded-7</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tomcat.embed</groupId>
-            <artifactId>tomcat-embed-core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tomcat.embed</groupId>
-            <artifactId>tomcat-embed-jasper</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tomcat.embed</groupId>
-            <artifactId>tomcat-embed-logging-juli</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jdt.core.compiler</groupId>
-            <artifactId>ecj</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>net.sourceforge.htmlunit</groupId>
-            <artifactId>htmlunit</artifactId>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <version>2.4</version>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>test-jar</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin> <!-- use mvn tomcat7:run  -->
-                <groupId>org.apache.tomcat.maven</groupId>
-                <artifactId>tomcat7-maven-plugin</artifactId>
-                <version>2.2</version>
-                <configuration>
-                    <ignorePackaging>true</ignorePackaging>
-                    <path>/</path>
-                    <warSourceDirectory>${project.basedir}/src/main/resources/META-INF/resources</warSourceDirectory>
-                    <additionalClasspathDirs>
-                        <additionalClasspathDir>${project.build.directory}/${project.build.finalName}.${project.packaging}
-                        </additionalClasspathDir>
-                        <additionalClasspathDir>${project.build.directory}/${project.build.finalName}-tests.${project.packaging}
-                        </additionalClasspathDir>
-                    </additionalClasspathDirs>
-                </configuration>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.apache.geronimo.specs</groupId>
-                        <artifactId>geronimo-atinject_1.0_spec</artifactId>
-                        <version>${atinject.version}</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.apache.geronimo.specs</groupId>
-                        <artifactId>geronimo-atinject_1.0_spec</artifactId>
-                        <version>${atinject.version}</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.apache.geronimo.specs</groupId>
-                        <artifactId>geronimo-jbatch_1.0_spec</artifactId>
-                        <version>${batch-api.version}</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>com.fasterxml.jackson.jaxrs</groupId>
-                        <artifactId>jackson-jaxrs-json-provider</artifactId>
-                        <version>${jackson.version}</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.apache.cxf</groupId>
-                        <artifactId>cxf-rt-frontend-jaxrs</artifactId>
-                        <version>${cxf.version}</version>
-                        <exclusions>
-                            <exclusion>
-                                <groupId>com.sun.xml.bind</groupId>
-                                <artifactId>jaxb-impl</artifactId>
-                            </exclusion>
-                            <exclusion>
-                                <groupId>org.apache.geronimo.specs</groupId>
-                                <artifactId>geronimo-javamail_1.4_spec</artifactId>
-                            </exclusion>
-                            <exclusion>
-                                <groupId>org.apache.ws.xmlschema</groupId>
-                                <artifactId>xmlschema-core</artifactId>
-                            </exclusion>
-                            <exclusion>
-                                <groupId>org.codehaus.woodstox</groupId>
-                                <artifactId>woodstox-core-asl</artifactId>
-                            </exclusion>
-                        </exclusions>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.apache.batchee</groupId>
-                        <artifactId>batchee-jbatch</artifactId>
-                        <version>${project.version}</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
-        </plugins>
-    </build>
+          </dependency>
+        </dependencies>
+      </plugin>
+    </plugins>
+  </build>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/1d1f1161/jbatch/src/main/java/org/apache/batchee/container/impl/controller/BaseStepController.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/impl/controller/BaseStepController.java b/jbatch/src/main/java/org/apache/batchee/container/impl/controller/BaseStepController.java
index 63636eb..d261598 100755
--- a/jbatch/src/main/java/org/apache/batchee/container/impl/controller/BaseStepController.java
+++ b/jbatch/src/main/java/org/apache/batchee/container/impl/controller/BaseStepController.java
@@ -74,7 +74,7 @@ public abstract class BaseStepController implements ExecutionElementController {
     protected long rootJobExecutionId;
 
     protected final BatchKernelService kernelService;
-    private final PersistenceManagerService persistenceManagerService;
+    protected final PersistenceManagerService persistenceManagerService;
     private final JobStatusManagerService statusManagerService;
 
     protected TransactionManagerAdapter transactionManager = null;

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/1d1f1161/jbatch/src/main/java/org/apache/batchee/container/impl/controller/PartitionedStepController.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/impl/controller/PartitionedStepController.java b/jbatch/src/main/java/org/apache/batchee/container/impl/controller/PartitionedStepController.java
index 01444ef..b673e3d 100755
--- a/jbatch/src/main/java/org/apache/batchee/container/impl/controller/PartitionedStepController.java
+++ b/jbatch/src/main/java/org/apache/batchee/container/impl/controller/PartitionedStepController.java
@@ -49,6 +49,8 @@ import javax.batch.operations.JobExecutionNotMostRecentException;
 import javax.batch.operations.JobRestartException;
 import javax.batch.operations.JobStartException;
 import javax.batch.runtime.BatchStatus;
+import javax.batch.runtime.Metric;
+import javax.batch.runtime.StepExecution;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
@@ -361,7 +363,16 @@ public class PartitionedStepController extends BaseStepController {
         boolean rollback = false;
 
         for (final BatchWorkUnit subJob : completedWork) {
-            BatchStatus batchStatus = subJob.getJobExecutionImpl().getJobContext().getBatchStatus();
+            final List<StepExecution> steps = persistenceManagerService.getStepExecutionsForJobExecution(subJob.getJobExecutionImpl().getExecutionId());
+            if (steps.size() != 1) {
+                // TODO: possible?
+            } else {
+                for (final Metric metric : steps.iterator().next().getMetrics()) {
+                    stepContext.getMetric(metric.getType()).incValueBy(metric.getValue());
+                }
+            }
+
+            final BatchStatus batchStatus = subJob.getJobExecutionImpl().getJobContext().getBatchStatus();
             if (batchStatus.equals(BatchStatus.FAILED)) {
                 rollback = true;
 

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/1d1f1161/jbatch/src/test/java/org/apache/batchee/test/metric/PartitionMetricsTest.java
----------------------------------------------------------------------
diff --git a/jbatch/src/test/java/org/apache/batchee/test/metric/PartitionMetricsTest.java b/jbatch/src/test/java/org/apache/batchee/test/metric/PartitionMetricsTest.java
index 7b52314..20fe0f4 100644
--- a/jbatch/src/test/java/org/apache/batchee/test/metric/PartitionMetricsTest.java
+++ b/jbatch/src/test/java/org/apache/batchee/test/metric/PartitionMetricsTest.java
@@ -1,4 +1,86 @@
+/*
+ * 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.batchee.test.metric;
 
+import org.apache.batchee.util.Batches;
+import org.testng.annotations.Test;
+
+import javax.batch.api.BatchProperty;
+import javax.batch.api.chunk.AbstractItemReader;
+import javax.batch.api.chunk.AbstractItemWriter;
+import javax.batch.operations.JobOperator;
+import javax.batch.runtime.BatchRuntime;
+import javax.batch.runtime.Metric;
+import javax.batch.runtime.StepExecution;
+import javax.inject.Inject;
+import java.io.FileNotFoundException;
+import java.util.List;
+
+import static org.testng.Assert.assertEquals;
+
 public class PartitionMetricsTest {
+    @Test
+    public void run() {
+        final JobOperator op = BatchRuntime.getJobOperator();
+        final long id = op.start("partition-metrics", null);
+        Batches.waitForEnd(op, id);
+        final List<StepExecution> steps = op.getStepExecutions(id);
+        assertEquals(1, steps.size());
+        final StepExecution exec = steps.iterator().next();
+        final Metric[] metrics = exec.getMetrics();
+        int checked = 0;
+        for (final Metric metric : metrics) {
+            if (Metric.MetricType.ROLLBACK_COUNT == metric.getType()) {
+                assertEquals(metric.getValue(), 2);
+                checked++;
+            } else if (Metric.MetricType.READ_SKIP_COUNT == metric.getType()) {
+                assertEquals(metric.getValue(), 1);
+                checked++;
+            }
+        }
+        assertEquals(checked, 2);
+    }
+
+    public static class Reader extends AbstractItemReader {
+        @Inject
+        @BatchProperty
+        private Integer idx;
+
+        @Override
+        public Object readItem() throws Exception {
+            try {
+                switch (idx) {
+                    case 1:
+                        throw new IllegalArgumentException();
+                    case 2:
+                        throw new FileNotFoundException();
+                    default:
+                }
+            } finally {
+                idx = 0;
+            }
+            return null;
+        }
+    }
+
+    public static class Writer extends AbstractItemWriter {
+        @Override
+        public void writeItems(final List<Object> items) throws Exception {
+            // no-op
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/1d1f1161/jbatch/src/test/resources/META-INF/batch-jobs/partition-metrics.xml
----------------------------------------------------------------------
diff --git a/jbatch/src/test/resources/META-INF/batch-jobs/partition-metrics.xml b/jbatch/src/test/resources/META-INF/batch-jobs/partition-metrics.xml
index e44c036..eff7053 100644
--- a/jbatch/src/test/resources/META-INF/batch-jobs/partition-metrics.xml
+++ b/jbatch/src/test/resources/META-INF/batch-jobs/partition-metrics.xml
@@ -13,8 +13,32 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<job id="jmx" version="1.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee">
-  <step id="jmx-step">
-    <batchlet ref="org.apache.batchee.test.mock.BatchletMock"/>
+<job id="partition-metrics" version="1.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee">
+  <step id="part-step">
+    <chunk>
+      <reader ref="org.apache.batchee.test.metric.PartitionMetricsTest$Reader">
+        <properties>
+          <property name="idx" value="#{partitionPlan['idx']}" />
+        </properties>
+      </reader>
+      <writer ref="org.apache.batchee.test.metric.PartitionMetricsTest$Writer" />
+
+      <skippable-exception-classes>
+        <include class="java.io.FileNotFoundException" />
+      </skippable-exception-classes>
+      <retryable-exception-classes>
+        <include class="java.lang.IllegalArgumentException" />
+      </retryable-exception-classes>
+    </chunk>
+    <partition>
+      <plan partitions="2" threads="2">
+        <properties partition="0">
+          <property name="idx" value="1" />
+        </properties>
+        <properties partition="1">
+          <property name="idx" value="2" />
+        </properties>
+      </plan>
+    </partition>
   </step>
 </job>

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/1d1f1161/tools/maven-plugin/src/main/java/org/apache/batchee/tools/maven/DiagramMojo.java
----------------------------------------------------------------------
diff --git a/tools/maven-plugin/src/main/java/org/apache/batchee/tools/maven/DiagramMojo.java b/tools/maven-plugin/src/main/java/org/apache/batchee/tools/maven/DiagramMojo.java
index 9747bf6..25db971 100644
--- a/tools/maven-plugin/src/main/java/org/apache/batchee/tools/maven/DiagramMojo.java
+++ b/tools/maven-plugin/src/main/java/org/apache/batchee/tools/maven/DiagramMojo.java
@@ -40,8 +40,10 @@ import edu.uci.ics.jung.visualization.renderers.BasicEdgeLabelRenderer;
 import edu.uci.ics.jung.visualization.renderers.Renderer;
 import edu.uci.ics.jung.visualization.transform.shape.GraphicsDecorator;
 import org.apache.batchee.container.jsl.ExecutionElement;
+import org.apache.batchee.container.jsl.IllegalTransitionException;
 import org.apache.batchee.container.jsl.JobModelResolver;
 import org.apache.batchee.container.jsl.TransitionElement;
+import org.apache.batchee.container.navigator.JobNavigator;
 import org.apache.batchee.jaxb.End;
 import org.apache.batchee.jaxb.Fail;
 import org.apache.batchee.jaxb.Flow;
@@ -151,6 +153,13 @@ public class DiagramMojo extends AbstractMojo {
     private void visitBatch(final JSLJob job, final Diagram diagram) throws MojoExecutionException {
         final Map<String, Node> nodes = new HashMap<String, Node>();
 
+        String first = null;
+        try {
+            first = new JobNavigator(job).getFirstExecutionElement(null).getId();
+        } catch (final Exception e) {
+            // no-op
+        }
+
         // create nodes
         final List<ExecutionElement> executionElements = job.getExecutionElements();
         final Collection<ExecutionElement> allElements = new HashSet<ExecutionElement>();
@@ -158,7 +167,11 @@ public class DiagramMojo extends AbstractMojo {
 
         // create edges
         for (final ExecutionElement element : allElements) {
-            final Node source = nodes.get(element.getId());
+            final String id = element.getId();
+            final Node source = nodes.get(id);
+            if (id.equals(first)) {
+                source.root();
+            }
 
             if (Step.class.isInstance(element)) {
                 final String next = Step.class.cast(element).getNextFromAttribute();
@@ -353,10 +366,12 @@ public class DiagramMojo extends AbstractMojo {
 
         OutputStream os = null;
         try {
-            os = new FileOutputStream(new File(output, (outputFileName != null ? outputFileName : name) + "." + format));
+            final File file = new File(output, (outputFileName != null ? outputFileName : name) + "." + format);
+            os = new FileOutputStream(file);
             if (!ImageIO.write(bi, format, os)) {
                 throw new MojoExecutionException("can't save picture " + name + "." + format);
             }
+            getLog().info("Saved " + file.getAbsolutePath());
         } catch (final IOException e) {
             throw new MojoExecutionException("can't save the diagram", e);
         } finally {
@@ -417,11 +432,16 @@ public class DiagramMojo extends AbstractMojo {
 
         private final String text;
         private final Type type;
+        private boolean root = false;
 
         private Node(final String text, final Type type) {
             this.text = text;
             this.type = type;
         }
+
+        public void root() {
+            root = true;
+        }
     }
 
     private static class Edge {
@@ -489,15 +509,16 @@ public class DiagramMojo extends AbstractMojo {
     private static class VertexFillPaintTransformer implements Transformer<Node, Paint> {
         @Override
         public Paint transform(final Node node) {
-            /*
+            if (node.root) {
+                return Color.GREEN;
+            }
+
             switch (node.type) {
                 case SINK:
                     return Color.RED;
                 default:
-                    return Color.BLUE;
+                    return Color.WHITE;
             }
-            */
-            return Color.WHITE;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/1d1f1161/tools/maven-plugin/src/test/java/org/apache/batchee/tools/maven/DiagramMojoTest.java
----------------------------------------------------------------------
diff --git a/tools/maven-plugin/src/test/java/org/apache/batchee/tools/maven/DiagramMojoTest.java b/tools/maven-plugin/src/test/java/org/apache/batchee/tools/maven/DiagramMojoTest.java
index e7da1ec..e60f4fb 100644
--- a/tools/maven-plugin/src/test/java/org/apache/batchee/tools/maven/DiagramMojoTest.java
+++ b/tools/maven-plugin/src/test/java/org/apache/batchee/tools/maven/DiagramMojoTest.java
@@ -37,9 +37,9 @@ public class DiagramMojoTest {
         mojo.view = false;
         mojo.width = 640;
         mojo.height = 480;
-        mojo.adjust = false;
+        mojo.adjust = true;
         mojo.format = "png";
-        // mojo.layout = "spring200";
+        mojo.layout = "spring170";
         mojo.execute();
 
         assertTrue(target.exists());

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/1d1f1161/tools/maven-plugin/src/test/resources/META-INF/batch-jobs/diagram.xml
----------------------------------------------------------------------
diff --git a/tools/maven-plugin/src/test/resources/META-INF/batch-jobs/diagram.xml b/tools/maven-plugin/src/test/resources/META-INF/batch-jobs/diagram.xml
index 94ee1fb..750a32d 100644
--- a/tools/maven-plugin/src/test/resources/META-INF/batch-jobs/diagram.xml
+++ b/tools/maven-plugin/src/test/resources/META-INF/batch-jobs/diagram.xml
@@ -29,6 +29,8 @@
         <property name="fail" value="false" />
       </properties>
     </batchlet>
+    <next on="fine" to="sd-chunk" />
+    <end on="*" exit-status="STOP-ON-2" />
   </step>
   <step id="sd-chunk">
     <chunk>
@@ -47,7 +49,7 @@
     </chunk>
     <next on="restart" to="sd1" />
     <stop on="error" exit-status="ERROR"/>
-    <stop on="restart2" exit-status="RESTART" restart="sd2"/>
+    <stop on="restart2" exit-status="RESTART" restart="sd-chunk"/>
     <end on="finish" exit-status="DONE" />
     <fail on="failed" exit-status="FAILED" />
   </step>


[2/2] git commit: refactoring bar structure to be closer to wars but keeping batch descriptors outside of classes to keep it clear, note: wonder if we should extract config files (not file and not jbatch descriptor) from it too (configuration folder?)

Posted by rm...@apache.org.
refactoring bar structure to be closer to wars but keeping batch descriptors outside of classes to keep it clear, note: wonder if we should extract config files (not file and not jbatch descriptor) from it too (configuration folder?)


Project: http://git-wip-us.apache.org/repos/asf/incubator-batchee/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-batchee/commit/822b3df2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-batchee/tree/822b3df2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-batchee/diff/822b3df2

Branch: refs/heads/master
Commit: 822b3df21ece43906c2dfeb2b2682cbb30ba0075
Parents: 1d1f116
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Fri Jan 17 20:17:35 2014 +0100
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Fri Jan 17 20:17:35 2014 +0100

----------------------------------------------------------------------
 .../classloader/ChildFirstURLClassLoader.java   |  68 +++++++++++
 .../batchee/cli/command/JobOperatorCommand.java |  14 ++-
 .../org/apache/batchee/tools/maven/BarMojo.java | 115 +++++++++++++++----
 3 files changed, 172 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/822b3df2/tools/cli/src/main/java/org/apache/batchee/cli/classloader/ChildFirstURLClassLoader.java
----------------------------------------------------------------------
diff --git a/tools/cli/src/main/java/org/apache/batchee/cli/classloader/ChildFirstURLClassLoader.java b/tools/cli/src/main/java/org/apache/batchee/cli/classloader/ChildFirstURLClassLoader.java
index c69d65f..423285e 100644
--- a/tools/cli/src/main/java/org/apache/batchee/cli/classloader/ChildFirstURLClassLoader.java
+++ b/tools/cli/src/main/java/org/apache/batchee/cli/classloader/ChildFirstURLClassLoader.java
@@ -16,17 +16,85 @@
  */
 package org.apache.batchee.cli.classloader;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.LinkedList;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 public class ChildFirstURLClassLoader  extends URLClassLoader {
     private final ClassLoader system;
+    private final Collection<File> resources = new CopyOnWriteArrayList<File>();
 
     public ChildFirstURLClassLoader(final URL[] urls, final ClassLoader parent) {
         super(urls, parent);
         system = ClassLoader.getSystemClassLoader();
     }
 
+    public void addResource(final File resource) {
+        if (resource.isDirectory()) {
+            resources.add(resource);
+        }
+    }
+
+    @Override
+    public URL findResource(final String name) {
+        try {
+            final Collection<URL> urls = findResourceUrls(name, name);
+            if (urls != null) { // if not null -> not empty by design
+                return urls.iterator().next();
+            }
+        } catch (final MalformedURLException e) {
+            // no-op: use parent behavior
+        }
+        return super.findResource(name);
+    }
+
+    @Override
+    public Enumeration<URL> findResources(final String name) throws IOException {
+        final Enumeration<URL> defaultResources = super.findResources(name);
+        if (name == null) {
+            return defaultResources;
+        }
+
+        final Collection<URL> urls = findResourceUrls(name, name);
+        if (urls != null) {
+            urls.addAll(Collections.list(defaultResources));
+            return Collections.enumeration(urls);
+        }
+        return defaultResources;
+    }
+
+    private Collection<URL> findResourceUrls(final String inName, final String nameWithoutSlash) throws MalformedURLException {
+        final String name;
+        if (inName.startsWith("/") && inName.length() > 1) {
+            name = inName.substring(1);
+        } else {
+            name = inName;
+        }
+
+        Collection<URL> urls = null; // created lazily
+        if ((name.startsWith("META-INF/batch-jobs/")
+                || name.endsWith("batch.xml") || name.endsWith("batchee.xml"))
+                && nameWithoutSlash.endsWith(".xml")) {
+            for (final File folder : resources) {
+                final File resource = new File(folder, nameWithoutSlash.replace("META-INF/", ""));
+                if (resource.isFile()) {
+                    if (urls == null) {
+                        urls = new LinkedList<URL>();
+                    }
+                    urls.add(resource.toURI().toURL());
+                }
+            }
+        }
+        return urls;
+    }
+
     @Override
     public Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException {
         // already loaded?

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/822b3df2/tools/cli/src/main/java/org/apache/batchee/cli/command/JobOperatorCommand.java
----------------------------------------------------------------------
diff --git a/tools/cli/src/main/java/org/apache/batchee/cli/command/JobOperatorCommand.java b/tools/cli/src/main/java/org/apache/batchee/cli/command/JobOperatorCommand.java
index 8e7b5e4..309fb64 100644
--- a/tools/cli/src/main/java/org/apache/batchee/cli/command/JobOperatorCommand.java
+++ b/tools/cli/src/main/java/org/apache/batchee/cli/command/JobOperatorCommand.java
@@ -213,6 +213,7 @@ public abstract class JobOperatorCommand implements Runnable {
         }
 
         // we add libs/*.jar and libs/xxx/*.jar to be able to sort libs but only one level to keep it simple
+        File resources = null;
         if (archive != null) {
             final File bar = new File(archive);
             final File exploded;
@@ -243,9 +244,9 @@ public abstract class JobOperatorCommand implements Runnable {
                 }
 
                 // bar archives are split accross 3 folders
-                addFolder(new File(exploded, "batch/jobs"), urls);
-                addFolder(new File(exploded, "batch/classes"), urls);
-                addFolder(new File(exploded, "libs"), urls);
+                addFolder(new File(exploded, "BATCH-INF/classes"), urls);
+                addFolder(new File(exploded, "BATCH-INF/lib"), urls);
+                resources = new File(exploded, "BATCH-INF");
             } else {
                 throw new IllegalArgumentException("'" + archive + "' doesn't exist");
             }
@@ -255,7 +256,12 @@ public abstract class JobOperatorCommand implements Runnable {
         if (libs == null && archive == null) {
             return sharedClassLoader;
         }
-        return new ChildFirstURLClassLoader(urls.toArray(new URL[urls.size()]), sharedClassLoader);
+
+        final ChildFirstURLClassLoader classLoader = new ChildFirstURLClassLoader(urls.toArray(new URL[urls.size()]), sharedClassLoader);
+        if (resources != null && resources.exists()) {
+            classLoader.addResource(resources);
+        }
+        return classLoader;
     }
 
     private ClassLoader createSharedClassLoader(final ClassLoader parent) throws MalformedURLException {

http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/822b3df2/tools/maven-plugin/src/main/java/org/apache/batchee/tools/maven/BarMojo.java
----------------------------------------------------------------------
diff --git a/tools/maven-plugin/src/main/java/org/apache/batchee/tools/maven/BarMojo.java b/tools/maven-plugin/src/main/java/org/apache/batchee/tools/maven/BarMojo.java
index 080b4f3..e13fc51 100644
--- a/tools/maven-plugin/src/main/java/org/apache/batchee/tools/maven/BarMojo.java
+++ b/tools/maven-plugin/src/main/java/org/apache/batchee/tools/maven/BarMojo.java
@@ -32,14 +32,20 @@ import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectHelper;
+import org.codehaus.plexus.archiver.ArchiveEntry;
 import org.codehaus.plexus.archiver.Archiver;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.ResourceIterator;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 import org.codehaus.plexus.archiver.util.DefaultFileSet;
 import org.codehaus.plexus.components.io.fileselectors.FileInfo;
 import org.codehaus.plexus.components.io.fileselectors.FileSelector;
+import org.codehaus.plexus.components.io.resources.PlexusIoFileResource;
+import org.codehaus.plexus.components.io.resources.PlexusIoResource;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.Iterator;
 import java.util.List;
 
 import static java.util.Arrays.asList;
@@ -57,7 +63,7 @@ import static java.util.Arrays.asList;
  */
 @Mojo(name = "bar", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, defaultPhase = LifecyclePhase.PACKAGE)
 public class BarMojo extends AbstractMojo {
-    private static final String JOB_XML_PATH = "META-INF/batch-jobs/";
+    private static final BatchDescriptorSelector JOB_SELECTOR = new BatchDescriptorSelector();
 
     @Component(role = Archiver.class, hint = "jar")
     private JarArchiver jarArchiver;
@@ -92,6 +98,9 @@ public class BarMojo extends AbstractMojo {
     @Parameter(property = "batchee.classes", defaultValue = "${project.build.directory}/classes")
     private File classes;
 
+    @Parameter(property = "batchee.maven-descriptors", defaultValue = "true")
+    private boolean mavenDescriptors;
+
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
         if (classifier == null && !"bar".equals(project.getPackaging())) {
@@ -111,17 +120,13 @@ public class BarMojo extends AbstractMojo {
     private File createBar() throws MojoExecutionException {
         final File target = new File(outputDirectory, finalName + (classifier != null ? classifier : "") + ".bar");
 
-        final MavenArchiver archiver = new MavenArchiver();
-        archiver.setOutputFile(target);
-        archiver.setArchiver(jarArchiver);
-
         // lib/*
         try {
             for (final Artifact dependency : resolver.resolve(project, asList("compile", "runtime", "system"), session)) {
                 if ("provided".equals(dependency.getScope())) { // not sure why compile triggers provided using resolver
                     continue;
                 }
-                jarArchiver.addFile(dependency.getFile(), "libs/" + artifactPath(dependency));
+                jarArchiver.addFile(dependency.getFile(), "BATCH-INF/lib/" + artifactPath(dependency));
             }
         } catch (final Exception e) {
             throw new MojoExecutionException(e.getMessage(), e);
@@ -129,11 +134,10 @@ public class BarMojo extends AbstractMojo {
 
         // classes
         if (classes.isDirectory()) {
-            final FileSelector jobSelector = new FileSelector() {
+            final FileSelector classesSelector = new FileSelector() {
                 @Override
                 public boolean isSelected(final FileInfo fileInfo) throws IOException {
-                    final String name = fileInfo.getName();
-                    return name.replace('\\', '/').startsWith(JOB_XML_PATH) && name.endsWith(".xml");
+                    return !JOB_SELECTOR.isSelected(fileInfo);
                 }
             };
 
@@ -141,24 +145,71 @@ public class BarMojo extends AbstractMojo {
             fileSet.setDirectory(classes);
             fileSet.setIncludingEmptyDirectories(false);
 
-            fileSet.setPrefix("batch/classes/");
-            fileSet.setFileSelectors(new FileSelector[]{
-                    new FileSelector() {
-                        @Override
-                        public boolean isSelected(final FileInfo fileInfo) throws IOException {
-                            return !jobSelector.isSelected(fileInfo);
-                        }
-                    }
-            });
+            fileSet.setPrefix("BATCH-INF/classes/");
+            fileSet.setFileSelectors(new FileSelector[]{classesSelector});
             jarArchiver.addFileSet(fileSet);
 
-            fileSet.setPrefix("batch/jobs/");
-            fileSet.setFileSelectors(new FileSelector[]{ jobSelector });
+            fileSet.setPrefix("BATCH-INF/");
+            fileSet.setFileSelectors(new FileSelector[]{JOB_SELECTOR});
             jarArchiver.addFileSet(fileSet);
         }
 
+        final MavenArchiveConfiguration archiveConfiguration = new MavenArchiveConfiguration();
+        archiveConfiguration.setAddMavenDescriptor(mavenDescriptors);
+
+        final MavenArchiver archiver = new MavenArchiver();
+        archiver.setOutputFile(target);
+        archiver.setArchiver(new JarArchiver() {
+            {
+                archiveType = "bar";
+            }
+
+            @Override
+            public void addFile( final File inputFile, final String destFileName ) throws ArchiverException {
+                jarArchiver.addFile(inputFile, destFileName);
+            }
+
+            @Override
+            public ResourceIterator getResources() throws ArchiverException {
+                final Iterator<ResourceIterator> iterators = asList(jarArchiver.getResources(), super.getResources()).iterator();
+                return new ResourceIterator() {
+                    private ResourceIterator ri = iterators.next();
+
+                    @Override
+                    public boolean hasNext() {
+                        if (ri.hasNext()) {
+                            return true;
+                        } else if (iterators.hasNext()) {
+                            ri = iterators.next();
+                        }
+                        return ri.hasNext();
+                    }
+
+                    @Override
+                    public ArchiveEntry next() {
+                        final ArchiveEntry next = ri.next();
+                        final PlexusIoResource resource = next.getResource();
+                        if (resource != null && PlexusIoFileResource.class.isInstance(resource)) {
+                            final File file = PlexusIoFileResource.class.cast(resource).getFile();
+                            final String name = next.getName();
+
+                            if (JOB_SELECTOR.accept(resource.getName())) {
+                                return ArchiveEntry.createEntry(name.replace(File.separatorChar, '/').replaceFirst("META\\-INF/", ""), file, next.getType(), next.getMode());
+                            }
+                        }
+                        return next;
+                    }
+
+                    @Override
+                    public void remove() {
+                        throw new UnsupportedOperationException();
+                    }
+                };
+            }
+        });
+
         try {
-            archiver.createArchive(session, project, new MavenArchiveConfiguration());
+            archiver.createArchive(session, project, archiveConfiguration);
         } catch (final Exception e) {
             throw new MojoExecutionException(e.getMessage(), e);
         }
@@ -189,4 +240,26 @@ public class BarMojo extends AbstractMojo {
         sb.append('.').append(artifact.getType());
         return sb.toString();
     }
+
+    private static class BatchDescriptorSelector implements FileSelector {
+        private static final String JOB_XML_PATH = "META-INF/batch-jobs/";
+
+        @Override
+        public boolean isSelected(final FileInfo fileInfo) throws IOException {
+            final String name = fileInfo.getName();
+            return accept(name);
+        }
+
+        public boolean accept(final String name) {
+            final String nameWithoutSlash;
+            if (name.startsWith("/")) {
+                nameWithoutSlash = name.substring(1);
+            } else {
+                nameWithoutSlash = name;
+            }
+            return (nameWithoutSlash.replace('\\', '/').startsWith(JOB_XML_PATH) && nameWithoutSlash.endsWith(".xml"))
+                    || "META-INF/batch.xml".equals(name)
+                    || "META-INF/batchee.xml".equals(name);
+        }
+    }
 }