geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: rev 53854 - geronimo/trunk/modules/maven-plugin/src/java/org/apache/geronimo/deployment/mavenplugin
Date Wed, 06 Oct 2004 06:52:01 GMT
Author: dblevins
Date: Tue Oct  5 23:52:00 2004
New Revision: 53854

Modified:
   geronimo/trunk/modules/maven-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartRemoteServer.java
Log:
Added ability to set files for system out and err.


Modified: geronimo/trunk/modules/maven-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartRemoteServer.java
==============================================================================
--- geronimo/trunk/modules/maven-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartRemoteServer.java
(original)
+++ geronimo/trunk/modules/maven-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartRemoteServer.java
Tue Oct  5 23:52:00 2004
@@ -17,10 +17,7 @@
 
 package org.apache.geronimo.deployment.mavenplugin;
 
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
+import java.io.*;
 import java.util.ArrayList;
 import java.util.StringTokenizer;
 
@@ -34,6 +31,12 @@
     private String vmArgs = "";
     private String configs;
     private String debugPort;
+    private String output;
+    private String error;
+    private PrintStream out = System.out;
+    private PrintStream err = System.err;
+
+
 
     public String getGeronimoTarget() {
         return geronimoTarget;
@@ -67,6 +70,47 @@
         this.debugPort = debugPort;
     }
 
+    public String getOutput() {
+        return output;
+    }
+
+    public void setOutput(String output) {
+        this.output = output;
+    }
+
+    public String getError() {
+        return error;
+    }
+
+    public void setError(String error) {
+        this.error = error;
+    }
+
+    private PrintStream getOut() {
+        try {
+            if (getOutput() != null) {
+                out = new PrintStream(new FileOutputStream(getOutput()));
+            }
+        } catch (FileNotFoundException e) {
+            System.err.println(e.getMessage());
+        }
+
+        return out;
+    }
+
+    private PrintStream getErr() {
+        try {
+            if (getError() != null) {
+                err = new PrintStream(new FileOutputStream(getError()));
+            } else if (getOutput() != null) {
+                err = getOut();
+            }
+        } catch (FileNotFoundException e) {
+            System.err.println(e.getMessage());
+        }
+        return err;
+    }
+
     public void execute() throws Exception {
         ArrayList cmd = new ArrayList();
         File root = new File(getGeronimoTarget());
@@ -102,13 +146,13 @@
 
         // Pipe the processes STDOUT to ours
         InputStream out = server.getInputStream();
-        Thread serverOut = new Thread(new Pipe(out, System.out));
+        Thread serverOut = new Thread(new Pipe(out, getOut()));
         serverOut.setDaemon(true);
         serverOut.start();
 
         // Pipe the processes STDERR to ours
         InputStream err = server.getErrorStream();
-        Thread serverErr = new Thread(new Pipe(err, System.err));
+        Thread serverErr = new Thread(new Pipe(err, getErr()));
         serverErr.setDaemon(true);
         serverErr.start();
 

Mime
View raw message