airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1434482 - in /airavata/trunk/modules/distribution: ./ xbaya-gui/ xbaya-gui/src/main/java/ xbaya-gui/src/main/java/org/ xbaya-gui/src/main/java/org/apache/ xbaya-gui/src/main/java/org/apache/airavata/ xbaya-gui/src/main/java/org/apache/aira...
Date Wed, 16 Jan 2013 23:24:49 GMT
Author: samindaw
Date: Wed Jan 16 23:24:34 2013
New Revision: 1434482

URL: http://svn.apache.org/viewvc?rev=1434482&view=rev
Log:
merging xbaya jnlp distribution with xbaya distribution

Added:
    airavata/trunk/modules/distribution/xbaya-gui/src/main/java/
    airavata/trunk/modules/distribution/xbaya-gui/src/main/java/org/
    airavata/trunk/modules/distribution/xbaya-gui/src/main/java/org/apache/
    airavata/trunk/modules/distribution/xbaya-gui/src/main/java/org/apache/airavata/
    airavata/trunk/modules/distribution/xbaya-gui/src/main/java/org/apache/airavata/distribution/
    airavata/trunk/modules/distribution/xbaya-gui/src/main/java/org/apache/airavata/distribution/xbaya/
    airavata/trunk/modules/distribution/xbaya-gui/src/main/java/org/apache/airavata/distribution/xbaya/jnlp/
    airavata/trunk/modules/distribution/xbaya-gui/src/main/java/org/apache/airavata/distribution/xbaya/jnlp/Main.java
    airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/airavata-logo.gif   (with
props)
    airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/xbaya.jks   (with props)
    airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/xbaya.jnlp
Modified:
    airavata/trunk/modules/distribution/pom.xml
    airavata/trunk/modules/distribution/xbaya-gui/pom.xml

Modified: airavata/trunk/modules/distribution/pom.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/distribution/pom.xml?rev=1434482&r1=1434481&r2=1434482&view=diff
==============================================================================
--- airavata/trunk/modules/distribution/pom.xml (original)
+++ airavata/trunk/modules/distribution/pom.xml Wed Jan 16 23:24:34 2013
@@ -32,7 +32,6 @@
                 <module>airavata-server</module>
                 <module>airavata-client</module>
                 <module>xbaya-gui</module>
-                <module>xbaya-gui-jnlp</module>
             </modules>
         </profile>
     </profiles>

Modified: airavata/trunk/modules/distribution/xbaya-gui/pom.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/distribution/xbaya-gui/pom.xml?rev=1434482&r1=1434481&r2=1434482&view=diff
==============================================================================
--- airavata/trunk/modules/distribution/xbaya-gui/pom.xml (original)
+++ airavata/trunk/modules/distribution/xbaya-gui/pom.xml Wed Jan 16 23:24:34 2013
@@ -24,7 +24,26 @@
     <url>http://airavata.apache.org/</url>
 
     <build>
+
         <plugins>
+			<plugin>
+		        <groupId>org.apache.maven.plugins</groupId>
+		        <artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+		            <encoding>UTF-8</encoding>
+		            <source>1.6</source>
+		            <target>1.6</target>
+		        </configuration>
+				<executions>
+              <execution>
+                        <id>default</id>
+                        <phase>compile</phase>
+                        <goals>
+			                <goal>compile</goal>
+                        </goals>
+                </execution>                  
+             </executions>
+		    </plugin>
             <!--plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-dependency-plugin</artifactId>
@@ -58,7 +77,7 @@
                 <executions>
                     <execution>
                         <id>distribution-package</id>
-                        <phase>package</phase>
+                        <phase>compile</phase>
                         <goals>
                             <goal>single</goal>
                         </goals>
@@ -73,13 +92,107 @@
                     </execution>
                 </executions>
             </plugin>
+
+			<!-- JNLP -->
+			<plugin>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>0-copy-xbaya</id>
+                        <phase>compile</phase>
+                        <configuration>
+                            <target>
+                                <taskdef resource="net/sf/antcontrib/antcontrib.properties"
+                                         classpathref="maven.dependency.classpath" />
+                                <unzip src="target/apache-airavata-xbaya-gui-${project.version}-bin.zip"
+                                       dest="${project.build.directory}/temp"/>
+                                <mkdir dir="${jnlp.direcotry}"/>
+                                <mkdir dir="${jnlp.direcotry}/lib"/>
+                                <copy todir="${jnlp.direcotry}/lib">
+                                    <fileset dir="${xbaya.directory}/lib"/>
+                                </copy>
+                                <copy file="${project.basedir}/src/main/resources/xbaya.jnlp"
todir="${jnlp.direcotry}"/>
+                                <copy file="${project.basedir}/src/main/resources/airavata-logo.gif"
todir="${jnlp.direcotry}"/>
+                            </target>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jarsigner-plugin</artifactId>
+                <version>1.2</version>
+                <executions>
+                    <execution>
+                        <id>1-sign</id>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>sign</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <archiveDirectory>${jnlp.direcotry}/lib</archiveDirectory>
+                    <keystore>${project.basedir}/src/main/resources/xbaya.jks</keystore>
+                    <alias>xbaya</alias>
+                    <storepass>xbaya-secret</storepass>
+                    <keypass>xbaya-secret</keypass>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <version>1.1.1</version>
+                <executions>
+                    <execution>
+						<id>2-execute-jnlp-modifier</id>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>java</goal>
+                        </goals>
+                        <configuration>
+                            <mainClass>org.apache.airavata.distribution.xbaya.jnlp.Main</mainClass>
+                            <arguments>
+                                <argument>${jnlp.direcotry}/lib</argument>
+                                <argument>${jnlp.direcotry}/xbaya.jnlp</argument>
+                            </arguments>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>3-zip-xbaya-jnlp</id>
+                        <phase>package</phase>
+                        <configuration>
+                            <target>
+                                <zip destfile="${airavata.xbaya-jnlp.zip}"
+                                     basedir="${jnlp.direcotry}"/>
+                                <tar destfile="${project.build.directory}/xbaya-jnlp-${project.version}.tar"
basedir="${jnlp.direcotry}"/>
+                                <gzip destfile="${airavata.xbaya-jnlp.tar.gz}" src="${project.build.directory}/xbaya-jnlp-${project.version}.tar"/>
+                                <delete file="${project.build.directory}/xbaya-jnlp-${project.version}.tar"/>
+                            </target>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+			<!-- END JNLP -->
+
 			<plugin>
 				<groupId>org.codehaus.mojo</groupId>
 				<artifactId>build-helper-maven-plugin</artifactId>
 				<version>1.7</version>
 				<executions>
 				  <execution>
-				    <id>attach-artifacts</id>
+				    <id>4-attach-artifacts</id>
 				    <phase>package</phase>
 				    <goals>
 				      <goal>attach-artifact</goal>
@@ -96,6 +209,16 @@
 				          <type>tar.gz</type>
 						  <classifier>bin</classifier>
 				        </artifact>
+						<artifact>
+				          <file>${airavata.xbaya-jnlp.zip}</file>
+				          <type>zip</type>
+						  <classifier>jnlp</classifier>
+				        </artifact>
+						<artifact>
+				          <file>${airavata.xbaya-jnlp.zip}</file>
+				          <type>tar.gz</type>
+						  <classifier>jnlp</classifier>
+				        </artifact>
 				      </artifacts>
 				    </configuration>
 				  </execution>
@@ -401,7 +524,22 @@
             <artifactId>jersey-core</artifactId>
             <version>${jersey.version}</version>
         </dependency>
-
+		<dependency>
+            <groupId>ant-contrib</groupId>
+            <artifactId>ant-contrib</artifactId>
+            <version>1.0b3</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>ant</groupId>
+                    <artifactId>ant</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ant</groupId>
+            <artifactId>ant-nodeps</artifactId>
+            <version>1.8.1</version>
+        </dependency>
     </dependencies>
     <properties>
         <jersey.version>1.13</jersey.version>
@@ -412,5 +550,10 @@
 		<airavata.xbaya-dist.name>${archieve.name}-${project.version}</airavata.xbaya-dist.name>
 		<airavata.xbaya-bin.zip>${project.build.directory}/${airavata.xbaya-dist.name}-bin.zip</airavata.xbaya-bin.zip>
 		<airavata.xbaya-bin.tar.gz>${project.build.directory}/${airavata.xbaya-dist.name}-bin.tar.gz</airavata.xbaya-bin.tar.gz>
+		<airavata.xbaya-jnlp.name>xbaya-jnlp-${project.version}</airavata.xbaya-jnlp.name>
+		<airavata.xbaya-jnlp.zip>${project.build.directory}/${airavata.xbaya-jnlp.name}.zip</airavata.xbaya-jnlp.zip>
+		<airavata.xbaya-jnlp.tar.gz>${project.build.directory}/${airavata.xbaya-jnlp.name}.tar.gz</airavata.xbaya-jnlp.tar.gz>
+		<xbaya.directory>${project.build.directory}/temp/apache-airavata-xbaya-gui-${project.version}</xbaya.directory>
+        <jnlp.direcotry>${project.build.directory}/jnlp</jnlp.direcotry>
     </properties>
 </project>

Added: airavata/trunk/modules/distribution/xbaya-gui/src/main/java/org/apache/airavata/distribution/xbaya/jnlp/Main.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/distribution/xbaya-gui/src/main/java/org/apache/airavata/distribution/xbaya/jnlp/Main.java?rev=1434482&view=auto
==============================================================================
--- airavata/trunk/modules/distribution/xbaya-gui/src/main/java/org/apache/airavata/distribution/xbaya/jnlp/Main.java
(added)
+++ airavata/trunk/modules/distribution/xbaya-gui/src/main/java/org/apache/airavata/distribution/xbaya/jnlp/Main.java
Wed Jan 16 23:24:34 2013
@@ -0,0 +1,137 @@
+package org.apache.airavata.distribution.xbaya.jnlp;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This class will go through lib directory and creates the jnlp configuration file.
+ */
+public class Main {
+
+    private static final String CONFIGURATION_ELEMENT = "DEPENDENT_JARS";
+
+    public static void main(String[] args) {
+
+        if (args.length != 2) {
+            System.err.println("[ERROR] JNLP creator must be given with lib directory of
Xbaya and JNLP template location.");
+            System.exit(-1);
+        }
+
+        String libDirectory = args[0];
+        String jnlpTemplateFile = args[1];
+
+        System.out.println("[INFO] The lib directory is " + libDirectory);
+        System.out.println("[INFO] The jnlp file is " + jnlpTemplateFile);
+
+        File libDirectoryFile = new File(libDirectory);
+
+        if (!libDirectoryFile.exists()) {
+            System.err.println("[ERROR] Invalid lib directory given - " + libDirectory +
". Cannot add dependent jars");
+            System.exit(-1);
+        }
+
+        File jnlpFile = new File(jnlpTemplateFile);
+        if (!jnlpFile.canRead()) {
+            System.err.println("[ERROR] Unable to read given jnlp file - " + jnlpTemplateFile
+ ".");
+            System.exit(-1);
+
+        }
+
+        StringBuilder stringBuilder = new StringBuilder();
+
+        // Read all dependencies
+        for (File file : libDirectoryFile.listFiles(new JarFileFilter())) {
+            String line = "<jar href=\"lib/" + file.getName() + "\"/>";
+            stringBuilder.append(line);
+            stringBuilder.append("\n");
+        }
+
+        //System.out.println(stringBuilder.toString());
+        modifyConfigurations(jnlpFile, stringBuilder);
+
+
+    }
+
+    private static void modifyConfigurations(File jnlpFile, StringBuilder dependencies) {
+
+        List<String> lines = new ArrayList<String>();
+
+        // first, read the file and store the changes
+        BufferedReader in = null;
+        try {
+            in = new BufferedReader(new FileReader(jnlpFile));
+        } catch (FileNotFoundException e) {
+            System.err.println("[ERROR] Error occurred while reading the file. " + e.getMessage());
+        }
+
+
+        String line = null;
+        if (in != null) {
+            try {
+                line = in.readLine();
+            } catch (IOException e) {
+                System.err.println("[ERROR] Error occurred while reading the file. " + e.getMessage());
+                try {
+                    in.close();
+                } catch (IOException e1) {
+                    System.err.println("[ERROR] Error occurred while closing the file. "
+ e.getMessage());
+                }
+            }
+        }
+
+        try {
+            while (line != null) {
+
+                if (line.trim().startsWith(CONFIGURATION_ELEMENT)) {
+                    line = line.replaceAll(CONFIGURATION_ELEMENT, dependencies.toString());
+                }
+                lines.add(line);
+                line = in.readLine();
+
+            }
+        } catch (IOException e) {
+            System.err.println("[ERROR] Error occurred while reading the file. " + e.getMessage());
+        } finally {
+            try {
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException e) {
+                System.err.println("[ERROR] Error occurred while closing the file. " + e.getMessage());
+            }
+        }
+
+
+        // now, write the file again with the changes
+        PrintWriter out = null;
+        try {
+            out = new PrintWriter(jnlpFile);
+            for (String l : lines) {
+                out.println(l);
+                out.flush();
+            }
+        } catch (FileNotFoundException e) {
+            System.err.println("[ERROR] Error occurred while writing back to the file. "
+ e.getMessage());
+        } finally {
+            if (out != null) {
+                out.flush();
+                out.close();
+            }
+        }
+
+    }
+
+    public static class JarFileFilter implements FilenameFilter {
+        String ext;
+
+        public JarFileFilter() {
+            this.ext = ".jar";
+        }
+
+        public boolean accept(File dir, String name) {
+            return name.endsWith(ext);
+        }
+    }
+
+}

Added: airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/airavata-logo.gif
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/airavata-logo.gif?rev=1434482&view=auto
==============================================================================
Binary file - no diff available.

Propchange: airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/airavata-logo.gif
------------------------------------------------------------------------------
    svn:executable = *

Propchange: airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/airavata-logo.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/xbaya.jks
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/xbaya.jks?rev=1434482&view=auto
==============================================================================
Binary file - no diff available.

Propchange: airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/xbaya.jks
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/xbaya.jnlp
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/xbaya.jnlp?rev=1434482&view=auto
==============================================================================
--- airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/xbaya.jnlp (added)
+++ airavata/trunk/modules/distribution/xbaya-gui/src/main/resources/xbaya.jnlp Wed Jan 16
23:24:34 2013
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<jnlp spec="1.0+"
+   codebase="http://localhost/airavata-xbaya/"
+   href="xbaya.jnlp">
+<information>
+	<title>XBaya</title>
+	<vendor>Apache Airavata</vendor>
+	<icon href="airavata-logo.gif"/>
+	<offline-allowed/>
+</information>
+<security>
+	<all-permissions/>
+</security>
+<resources>
+	<j2se version="1.5+" java-vm-args="-Xmx1024m" />
+
+	    DEPENDENT_JARS
+
+    <property name="log" value="org.apache.airavata.xbaya:ALL"/>
+</resources>
+<application-desc main-class="org.apache.airavata.xbaya.XBaya">
+
+</application-desc>
+</jnlp>



Mime
View raw message