Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-63 4c4fc458a -> 6c05042cb


# ignite-63


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6c05042c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6c05042c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6c05042c

Branch: refs/heads/ignite-63
Commit: 6c05042cbceafc71daf59393b8c9b5471b26bd51
Parents: 4c4fc45
Author: sboikov <sboi...@gridgain.com>
Authored: Fri Jan 23 12:42:46 2015 +0300
Committer: sboikov <sboi...@gridgain.com>
Committed: Fri Jan 23 12:42:46 2015 +0300

----------------------------------------------------------------------
 modules/extdata/p2p/pom.xml                     |   2 +-
 .../util/antgar/GridDeploymentGarAntTask.java   | 172 -------------------
 .../util/antgar/IgniteDeploymentGarAntTask.java | 172 +++++++++++++++++++
 .../GridUriDeploymentFileProcessorSelfTest.java |   2 +-
 .../apache/ignite/tools/GridToolsSelfTest.java  |  14 +-
 5 files changed, 181 insertions(+), 181 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c05042c/modules/extdata/p2p/pom.xml
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/pom.xml b/modules/extdata/p2p/pom.xml
index a9ff9e9..b598fde 100644
--- a/modules/extdata/p2p/pom.xml
+++ b/modules/extdata/p2p/pom.xml
@@ -86,7 +86,7 @@
                         <configuration>
                             <target>
                                 <taskdef name="gar"
-                                    
classname="org.gridgain.grid.util.antgar.GridDeploymentGarAntTask"/>
+                                    
classname="org.apache.ignite.util.antgar.IgniteDeploymentGarAntTask"/>
 
                                 <gar destfile="${basedir}/deploy/p2p.gar"
                                      descrdir="${basedir}/META-INF"

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c05042c/modules/tools/src/main/java/org/apache/ignite/util/antgar/GridDeploymentGarAntTask.java
----------------------------------------------------------------------
diff --git 
a/modules/tools/src/main/java/org/apache/ignite/util/antgar/GridDeploymentGarAntTask.java
 
b/modules/tools/src/main/java/org/apache/ignite/util/antgar/GridDeploymentGarAntTask.java
deleted file mode 100644
index 52617d2..0000000
--- 
a/modules/tools/src/main/java/org/apache/ignite/util/antgar/GridDeploymentGarAntTask.java
+++ /dev/null
@@ -1,172 +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.ignite.util.antgar;
-
-import org.apache.tools.ant.*;
-import org.apache.tools.ant.taskdefs.*;
-import org.apache.tools.ant.types.*;
-import org.apache.tools.zip.*;
-import java.io.*;
-
-/**
- * Ant task for generating GAR file. This task extends standard {@code zip} 
Ant task and
- * has two parameters:
- * <ul>
- * <li>{@code basedir} - Base directory for GAR archive.</li>
- * <li>
- *      {@code descrdir} - Directory where descriptor {@link #DESC_NAME} file 
is located.
- *      If not specified, it is assumed that GridGain descriptor will be 
searched in base directory
- *      (see {@link #setBasedir(File)}). <b>Note</b> further that GAR 
descriptor file is fully optional
- *      itself for GAR archive.
- * </li>
- * </ul>
- */
-public class GridDeploymentGarAntTask extends Zip {
-    /** GAR descriptor name. Its value is {@code gridgain.xml}. */
-    public static final String DESC_NAME = "gridgain.xml";
-
-    /**  Default descriptor path. */
-    private static final String DESC_PATH = "META-INF";
-
-    /** Descriptor directory. */
-    private File descDir;
-
-    /** Descriptor file name. */
-    private File descFile;
-
-    /** Base directory of Ant task. */
-    private File baseDir;
-
-    /**
-     * Creates ant task with default values.
-     */
-    public GridDeploymentGarAntTask() {
-        archiveType = "gar";
-        emptyBehavior = "create";
-    }
-
-    /**
-     * Sets the directory where descriptor is located. This parameter is 
optional and if not set Ant task
-     * will search for descriptor file in base directory. <b>Note</b> further 
that GAR descriptor file is fully optional
-     * itself for GAR archive.
-     *
-     * @param descDir Descriptor directory.
-     */
-    public void setDescrdir(File descDir) {
-        assert descDir != null;
-
-        this.descDir = descDir;
-    }
-
-    /**
-     * Sets base directory for the archive.
-     *
-     * @param baseDir Base archive directory to set.
-     */
-    @Override public void setBasedir(File baseDir) {
-        super.setBasedir(baseDir);
-
-        this.baseDir = baseDir;
-    }
-
-    /**
-     * Executes the Ant task.
-     */
-    @Override public void execute() {
-        setEncoding("UTF8");
-
-        // Otherwise super method will throw exception.
-        if (baseDir != null && baseDir.isDirectory()) {
-
-            File[] files = baseDir.listFiles(new FileFilter() {
-                /** {@inheritDoc} */
-                @Override public boolean accept(File pathname) {
-                    return pathname.isDirectory() && 
pathname.getName().equals(DESC_PATH);
-                }
-            });
-
-            if (files.length == 1) {
-                files = files[0].listFiles(new FileFilter() {
-                    /** {@inheritDoc} */
-                    @Override public boolean accept(File pathname) {
-                        return !pathname.isDirectory() && 
pathname.getName().equals(DESC_NAME);
-                    }
-                });
-            }
-
-            File desc = null;
-
-            if (files.length == 1)
-                desc = files[0];
-
-            // File was defined in source.
-            if (desc != null) {
-                if (descDir != null) {
-                    throw new BuildException("GridGain descriptor '" + 
DESC_NAME + "' is already " +
-                        "defined in source folder.");
-                }
-            }
-            // File wasn't defined in source and could be defined using 
'descrdir' attribute.
-            // Try to find the descriptor in defined directory.
-            else if (descDir != null) {
-                if (!descDir.isDirectory()) {
-                    throw new BuildException(
-                        "'descrdir' attribute isn't folder [dir=" + 
descDir.getAbsolutePath() + ']');
-                }
-
-                descFile = new File(getFullPath(descDir.getAbsolutePath(), 
DESC_NAME));
-
-                if (!descFile.exists()) {
-                    throw new BuildException("Folder doesn't contain GridGain 
descriptor [path=" +
-                            descDir.getAbsolutePath() + ']');
-                }
-            }
-        }
-
-        super.execute();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void initZipOutputStream(ZipOutputStream zOut) throws 
IOException {
-        if (descFile != null)
-            zipFile(descFile, zOut, getFullPath(DESC_PATH, DESC_NAME), 
ArchiveFileSet.DEFAULT_FILE_MODE);
-    }
-
-    /**
-     * Constructs full path given two other paths.
-     *
-     * @param subPath1 1st path.
-     * @param subPath2 2nd path.
-     * @return Full path.
-     */
-    private static String getFullPath(String subPath1, String subPath2) {
-        assert subPath1 != null;
-        assert subPath2 != null;
-
-        char c = subPath1.charAt(subPath1.length() - 1);
-
-        boolean b1 = c == '/' || c == '\\';
-
-        c = subPath2.charAt(0);
-
-        boolean b2 = c == '/' || c == '\\';
-
-        return b1 != b2 ? subPath1 + subPath2 : !b1 ? subPath1 + '/' + 
subPath2 :
-            subPath1.substring(0, subPath1.length() - 1) + File.separatorChar 
+ subPath2.substring(1);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c05042c/modules/tools/src/main/java/org/apache/ignite/util/antgar/IgniteDeploymentGarAntTask.java
----------------------------------------------------------------------
diff --git 
a/modules/tools/src/main/java/org/apache/ignite/util/antgar/IgniteDeploymentGarAntTask.java
 
b/modules/tools/src/main/java/org/apache/ignite/util/antgar/IgniteDeploymentGarAntTask.java
new file mode 100644
index 0000000..f3cd183
--- /dev/null
+++ 
b/modules/tools/src/main/java/org/apache/ignite/util/antgar/IgniteDeploymentGarAntTask.java
@@ -0,0 +1,172 @@
+/*
+ * 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.ignite.util.antgar;
+
+import org.apache.tools.ant.*;
+import org.apache.tools.ant.taskdefs.*;
+import org.apache.tools.ant.types.*;
+import org.apache.tools.zip.*;
+import java.io.*;
+
+/**
+ * Ant task for generating GAR file. This task extends standard {@code zip} 
Ant task and
+ * has two parameters:
+ * <ul>
+ * <li>{@code basedir} - Base directory for GAR archive.</li>
+ * <li>
+ *      {@code descrdir} - Directory where descriptor {@link #DESC_NAME} file 
is located.
+ *      If not specified, it is assumed that GridGain descriptor will be 
searched in base directory
+ *      (see {@link #setBasedir(File)}). <b>Note</b> further that GAR 
descriptor file is fully optional
+ *      itself for GAR archive.
+ * </li>
+ * </ul>
+ */
+public class IgniteDeploymentGarAntTask extends Zip {
+    /** GAR descriptor name. Its value is {@code gridgain.xml}. */
+    public static final String DESC_NAME = "gridgain.xml";
+
+    /**  Default descriptor path. */
+    private static final String DESC_PATH = "META-INF";
+
+    /** Descriptor directory. */
+    private File descDir;
+
+    /** Descriptor file name. */
+    private File descFile;
+
+    /** Base directory of Ant task. */
+    private File baseDir;
+
+    /**
+     * Creates ant task with default values.
+     */
+    public IgniteDeploymentGarAntTask() {
+        archiveType = "gar";
+        emptyBehavior = "create";
+    }
+
+    /**
+     * Sets the directory where descriptor is located. This parameter is 
optional and if not set Ant task
+     * will search for descriptor file in base directory. <b>Note</b> further 
that GAR descriptor file is fully optional
+     * itself for GAR archive.
+     *
+     * @param descDir Descriptor directory.
+     */
+    public void setDescrdir(File descDir) {
+        assert descDir != null;
+
+        this.descDir = descDir;
+    }
+
+    /**
+     * Sets base directory for the archive.
+     *
+     * @param baseDir Base archive directory to set.
+     */
+    @Override public void setBasedir(File baseDir) {
+        super.setBasedir(baseDir);
+
+        this.baseDir = baseDir;
+    }
+
+    /**
+     * Executes the Ant task.
+     */
+    @Override public void execute() {
+        setEncoding("UTF8");
+
+        // Otherwise super method will throw exception.
+        if (baseDir != null && baseDir.isDirectory()) {
+
+            File[] files = baseDir.listFiles(new FileFilter() {
+                /** {@inheritDoc} */
+                @Override public boolean accept(File pathname) {
+                    return pathname.isDirectory() && 
pathname.getName().equals(DESC_PATH);
+                }
+            });
+
+            if (files.length == 1) {
+                files = files[0].listFiles(new FileFilter() {
+                    /** {@inheritDoc} */
+                    @Override public boolean accept(File pathname) {
+                        return !pathname.isDirectory() && 
pathname.getName().equals(DESC_NAME);
+                    }
+                });
+            }
+
+            File desc = null;
+
+            if (files.length == 1)
+                desc = files[0];
+
+            // File was defined in source.
+            if (desc != null) {
+                if (descDir != null) {
+                    throw new BuildException("GridGain descriptor '" + 
DESC_NAME + "' is already " +
+                        "defined in source folder.");
+                }
+            }
+            // File wasn't defined in source and could be defined using 
'descrdir' attribute.
+            // Try to find the descriptor in defined directory.
+            else if (descDir != null) {
+                if (!descDir.isDirectory()) {
+                    throw new BuildException(
+                        "'descrdir' attribute isn't folder [dir=" + 
descDir.getAbsolutePath() + ']');
+                }
+
+                descFile = new File(getFullPath(descDir.getAbsolutePath(), 
DESC_NAME));
+
+                if (!descFile.exists()) {
+                    throw new BuildException("Folder doesn't contain GridGain 
descriptor [path=" +
+                            descDir.getAbsolutePath() + ']');
+                }
+            }
+        }
+
+        super.execute();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void initZipOutputStream(ZipOutputStream zOut) throws 
IOException {
+        if (descFile != null)
+            zipFile(descFile, zOut, getFullPath(DESC_PATH, DESC_NAME), 
ArchiveFileSet.DEFAULT_FILE_MODE);
+    }
+
+    /**
+     * Constructs full path given two other paths.
+     *
+     * @param subPath1 1st path.
+     * @param subPath2 2nd path.
+     * @return Full path.
+     */
+    private static String getFullPath(String subPath1, String subPath2) {
+        assert subPath1 != null;
+        assert subPath2 != null;
+
+        char c = subPath1.charAt(subPath1.length() - 1);
+
+        boolean b1 = c == '/' || c == '\\';
+
+        c = subPath2.charAt(0);
+
+        boolean b2 = c == '/' || c == '\\';
+
+        return b1 != b2 ? subPath1 + subPath2 : !b1 ? subPath1 + '/' + 
subPath2 :
+            subPath1.substring(0, subPath1.length() - 1) + File.separatorChar 
+ subPath2.substring(1);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c05042c/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorSelfTest.java
 
b/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorSelfTest.java
index 3be6b29..46c9331 100644
--- 
a/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorSelfTest.java
+++ 
b/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorSelfTest.java
@@ -104,7 +104,7 @@ public class GridUriDeploymentFileProcessorSelfTest extends 
GridUriDeploymentAbs
 
         File garFile = new File(baseDirName + File.separator + garFileName);
 
-        GridDeploymentGarAntTask garTask = new GridDeploymentGarAntTask();
+        IgniteDeploymentGarAntTask garTask = new IgniteDeploymentGarAntTask();
 
         Project garProject = new Project();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c05042c/modules/urideploy/src/test/java/org/apache/ignite/tools/GridToolsSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/urideploy/src/test/java/org/apache/ignite/tools/GridToolsSelfTest.java
 
b/modules/urideploy/src/test/java/org/apache/ignite/tools/GridToolsSelfTest.java
index 61528b9..5a4928d 100644
--- 
a/modules/urideploy/src/test/java/org/apache/ignite/tools/GridToolsSelfTest.java
+++ 
b/modules/urideploy/src/test/java/org/apache/ignite/tools/GridToolsSelfTest.java
@@ -60,7 +60,7 @@ public class GridToolsSelfTest extends GridCommonAbstractTest 
{
         // Copy files to basedir
         U.copy(new File(srcDirName), new File(baseDirName), true);
 
-        GridDeploymentGarAntTask garTask = new GridDeploymentGarAntTask();
+        IgniteDeploymentGarAntTask garTask = new IgniteDeploymentGarAntTask();
 
         Project garProject = new Project();
 
@@ -142,7 +142,7 @@ public class GridToolsSelfTest extends 
GridCommonAbstractTest {
         // Copy files to basedir
         U.copy(new File(srcDirName), new File(baseDirName), true);
 
-        GridDeploymentGarAntTask garTask = new GridDeploymentGarAntTask();
+        IgniteDeploymentGarAntTask garTask = new IgniteDeploymentGarAntTask();
 
         Project garProject = new Project();
 
@@ -192,7 +192,7 @@ public class GridToolsSelfTest extends 
GridCommonAbstractTest {
         // Copy files to basedir
         U.copy(new File(srcDirName), new File(baseDirName), true);
 
-        GridDeploymentGarAntTask garTask = new GridDeploymentGarAntTask();
+        IgniteDeploymentGarAntTask garTask = new IgniteDeploymentGarAntTask();
 
         Project garProject = new Project();
 
@@ -236,7 +236,7 @@ public class GridToolsSelfTest extends 
GridCommonAbstractTest {
         // Copy files to basedir
         U.copy(new File(srcDirName), new File(baseDirName), true);
 
-        GridDeploymentGarAntTask garTask = new GridDeploymentGarAntTask();
+        IgniteDeploymentGarAntTask garTask = new IgniteDeploymentGarAntTask();
 
         Project garProject = new Project();
 
@@ -281,7 +281,7 @@ public class GridToolsSelfTest extends 
GridCommonAbstractTest {
         // Copy files to basedir
         U.copy(new File(srcDirName), new File(baseDirName), true);
 
-        GridDeploymentGarAntTask garTask = new GridDeploymentGarAntTask();
+        IgniteDeploymentGarAntTask garTask = new IgniteDeploymentGarAntTask();
 
         Project garProject = new Project();
 
@@ -324,7 +324,7 @@ public class GridToolsSelfTest extends 
GridCommonAbstractTest {
         // Copy files to basedir
         U.copy(new File(srcDirName), new File(baseDirName), true);
 
-        GridDeploymentGarAntTask garTask = new GridDeploymentGarAntTask();
+        IgniteDeploymentGarAntTask garTask = new IgniteDeploymentGarAntTask();
 
         Project garProject = new Project();
 
@@ -368,7 +368,7 @@ public class GridToolsSelfTest extends 
GridCommonAbstractTest {
         // Copy files to basedir
         U.copy(new File(srcDirName), new File(baseDirName), true);
 
-        GridDeploymentGarAntTask garTask = new GridDeploymentGarAntTask();
+        IgniteDeploymentGarAntTask garTask = new IgniteDeploymentGarAntTask();
 
         Project garProject = new Project();
 

Reply via email to