logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From psm...@apache.org
Subject svn commit: r369178 - in /logging/chainsaw/trunk: anttasks-src/org/apache/chainsaw/ant/CreateShellScripts.java build.xml packaging/chainsawWebStart.jnlp
Date Sun, 15 Jan 2006 05:01:48 GMT
Author: psmith
Date: Sat Jan 14 20:59:46 2006
New Revision: 369178

URL: http://svn.apache.org/viewcvs?rev=369178&view=rev
Log:
webstart build now auto-creates the JNLP file with all the jars 
used during the building.

Modified:
    logging/chainsaw/trunk/anttasks-src/org/apache/chainsaw/ant/CreateShellScripts.java
    logging/chainsaw/trunk/build.xml
    logging/chainsaw/trunk/packaging/chainsawWebStart.jnlp

Modified: logging/chainsaw/trunk/anttasks-src/org/apache/chainsaw/ant/CreateShellScripts.java
URL: http://svn.apache.org/viewcvs/logging/chainsaw/trunk/anttasks-src/org/apache/chainsaw/ant/CreateShellScripts.java?rev=369178&r1=369177&r2=369178&view=diff
==============================================================================
--- logging/chainsaw/trunk/anttasks-src/org/apache/chainsaw/ant/CreateShellScripts.java (original)
+++ logging/chainsaw/trunk/anttasks-src/org/apache/chainsaw/ant/CreateShellScripts.java Sat
Jan 14 20:59:46 2006
@@ -1,8 +1,13 @@
 package org.apache.chainsaw.ant;
 
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringWriter;
 import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -54,9 +59,46 @@
         try {
             createUnixShellScript(outputLocationDir, filenames);
             createBatShellScript(outputLocationDir, filenames);
+            createJNLP(outputLocationDir, filenames);
         } catch (Exception e) {
+            e.printStackTrace();
             throw new BuildException("Failed to create Scripts",e);
         }        
+    }
+
+    
+    /**
+     * Creates a JNLP file for launching Chainsaw
+     * @param outputLocationDir
+     * @param filenames
+     * @throws IOException
+     */
+    private void createJNLP(File outputLocationDir, Collection filenames) throws IOException
{
+//        String templateName = CreateShellScripts.class.getPackage().toString().replace('.',
'/')+"/chainsawWebStart.jnlp";
+//        log("Using JNLP template: " + templateName);
+        BufferedReader reader = new BufferedReader(new FileReader(new File("packaging/chainsawWebStart.jnlp")));
+
+        // convert the file to a String
+        StringBuffer buf = new StringBuffer(1024);
+        String line;
+        while((line=reader.readLine())!=null) {
+            buf.append(line).append("\n");
+        }
+        
+        StringBuffer jarBuf = new StringBuffer();
+        for (Iterator iter = filenames.iterator(); iter.hasNext();) {
+            String jar = (String) iter.next();
+            jarBuf.append("\t<jar href=\"lib/"+jar + "\"/>\n");
+        }
+        // now replace the bits we want
+        int jarStringLocation = buf.indexOf("@JARS@");
+        buf.replace(jarStringLocation, jarStringLocation + 6, jarBuf.toString());
+//        TODO replace the CODEBASE stuff
+        
+        File jnlp = new File(outputLocationDir, "chainsawWebStart.jnlp");
+        Writer writer = new FileWriter(jnlp);
+        writer.write(buf.toString());
+        writer.close();
     }
 
     public void addFileSet(FileSet fileSet) {

Modified: logging/chainsaw/trunk/build.xml
URL: http://svn.apache.org/viewcvs/logging/chainsaw/trunk/build.xml?rev=369178&r1=369177&r2=369178&view=diff
==============================================================================
--- logging/chainsaw/trunk/build.xml (original)
+++ logging/chainsaw/trunk/build.xml Sat Jan 14 20:59:46 2006
@@ -264,7 +264,11 @@
 	      </patternset>
 	      <classpath refid="compile.classpath"/>   
 	    </javac>	
-		
+		<copy todir="${javac.dest}">
+			<fileset dir="anttasks-src">
+					<include name="*.jnlp"/>
+			</fileset>
+		</copy>
 		<taskdef name="createshellscripts" classpathref="compile.classpath" classname="org.apache.chainsaw.ant.CreateShellScripts"
/>
 	</target>
 	

Modified: logging/chainsaw/trunk/packaging/chainsawWebStart.jnlp
URL: http://svn.apache.org/viewcvs/logging/chainsaw/trunk/packaging/chainsawWebStart.jnlp?rev=369178&r1=369177&r2=369178&view=diff
==============================================================================
--- logging/chainsaw/trunk/packaging/chainsawWebStart.jnlp (original)
+++ logging/chainsaw/trunk/packaging/chainsawWebStart.jnlp Sat Jan 14 20:59:46 2006
@@ -2,16 +2,16 @@
 <!-- JNLP File for Jakarta Log4j Chainsaw v2 Application --> 
 <jnlp 
   spec="1.0+" 
-codebase="@CHAINSAW_CODEBASE@"
-  href="@CHAINSAW_CODEBASE@@CHAINSAW_JNLP_FILE@"> 
+codebase="http://logging.apache.org/log4j/docs/webstart/chainsaw/"
+  href="chainsawWebStart.jnlp"> 
   <information> 
     <title>Log4j Chainsaw v2</title> 
     <vendor>Apache</vendor> 
-    <homepage href="http://jakarta.apache.org/log4j"/> 
+    <homepage href="http://logging.apache.org/log4j"/> 
     <description>A Log4j log viewing application</description> 
     <description kind="short">A Log4j log viewing application</description> 
-    <icon href="http://jakarta.apache.org/log4j/docs/images/logo.jpg"/> 
-    <icon kind="splash" href="http://jakarta.apache.org/log4j/docs/images/logo.jpg"/>

+    <icon href="http://logging.apache.org/log4j/docs/images/logo.jpg"/> 
+    <icon kind="splash" href="http://logging.apache.org/log4j/docs/images/logo.jpg"/>

     <offline-allowed/> 
   </information> 
   <security> 
@@ -20,14 +20,7 @@
   <resources> 
     <j2se version="1.4+" max-heap-size="256m"/> 
     <j2se version="1.3+" max-heap-size="256m"/> 
-    <jar href="lib/log4j-chainsaw-1.3alpha-7.jar"/> 
-    <jar href="lib/log4j-1.3alpha-7.jar"/>
-    <jar href="lib/log4j-optional.jar"/>
-    <jar href="lib/log4j-xml.jar"/>
-    <jar href="lib/log4j-oro.jar"/>
-    <jar href="lib/ugli-simple.jar"/>
-    <jar href="lib/jakarta-oro-2.0.6.jar"/> 
-    <jar href="lib/xstream-1.1.2.jar"/> 
+@JARS@
   </resources> 
   <application-desc main-class="org.apache.log4j.chainsaw.LogUI"/> 
 </jnlp> 



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message