---
modules/enterprise/agent/ant-run.xml | 1 +
modules/enterprise/agent/pom.xml | 7 +++++++
.../java/org/rhq/enterprise/agent/AgentMain.java | 20 +++++++++++---------
.../rhq/enterprise/agent/AgentUpdateThread.java | 14 +-------------
modules/enterprise/remoting/cli/pom.xml | 2 --
pom.xml | 1 +
6 files changed, 21 insertions(+), 24 deletions(-)
diff --git a/modules/enterprise/agent/ant-run.xml b/modules/enterprise/agent/ant-run.xml
index 0b5db52..ec28381 100644
--- a/modules/enterprise/agent/ant-run.xml
+++ b/modules/enterprise/agent/ant-run.xml
@@ -34,6 +34,7 @@ ANT Script that provides ways to package the agent.
<include
name="javax/persistence/persistence-api/1.0/persistence-api-1.0.jar" />
<include name="i18nlog/i18nlog/1.0.9/i18nlog-1.0.9.jar" />
<include name="log4j/log4j/1.2.14/log4j-1.2.14.jar" />
+ <include
name="jline/jline/${jline.version}/jline-${jline.version}.jar" />
<include
name="commons-logging/commons-logging/1.1.0.jboss/commons-logging-1.1.0.jboss.jar"
/>
<include
name="gnu-getopt/getopt/${getopt.version}/getopt-${getopt.version}.jar" />
<include
name="commons-httpclient/commons-httpclient/2.0.2/commons-httpclient-2.0.2.jar"
/>
diff --git a/modules/enterprise/agent/pom.xml b/modules/enterprise/agent/pom.xml
index 33060fb..b4607c8 100644
--- a/modules/enterprise/agent/pom.xml
+++ b/modules/enterprise/agent/pom.xml
@@ -58,6 +58,12 @@
<artifactId>rhq-core-client-api</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ <version>${jline.version}</version>
+ </dependency>
<dependency>
<!-- The only reason why this is here is so we can pull this down from the
repo.
@@ -174,6 +180,7 @@ Build-Number=${buildNumber}
<property name="sigar.version"
value="${sigar.version}" />
<property name="jaxb-api.version"
value="${jaxb-api.version}" />
<property name="jaxb-impl.version"
value="${jaxb-impl.version}" />
+ <property name="jline.version"
value="${jline.version}" />
</ant>
</tasks>
</configuration>
diff --git
a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
index 32a7398..0d900d4 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
@@ -58,6 +58,8 @@ import java.util.prefs.Preferences;
import javax.management.MBeanServer;
import javax.management.ObjectName;
+import jline.ConsoleReader;
+
import mazz.i18n.Logger;
import mazz.i18n.Msg;
@@ -206,7 +208,7 @@ public class AgentMain {
/**
* The stream where the commands are input.
*/
- private BufferedReader m_input;
+ private ConsoleReader m_input;
/**
* Will be <code>true</code> if the input is coming directly from stdin;
<code>false</code> if an input script file
@@ -461,7 +463,7 @@ public class AgentMain {
m_agentHomeDirectory = null;
m_daemonMode = false;
- m_input = new BufferedReader(new InputStreamReader(System.in));
+ m_input = new ConsoleReader() ;
m_output = new AgentPrintWriter(System.out, true);
m_stdinInput = true;
m_configuration = null;
@@ -802,7 +804,7 @@ public class AgentMain {
*
* @return the input stream or <code>null</code> if the agent is not
currently accepting input
*/
- public BufferedReader getIn() {
+ public ConsoleReader getIn() {
return m_input;
}
@@ -1091,14 +1093,14 @@ public class AgentMain {
}
} else if (!m_stdinInput) {
// if we are processing a script, we hit the EOF, so close the input stream
- try {
- m_input.close();
- } catch (IOException e1) {
- }
+
// if we are not in daemon mode, let's now start processing prompt
commands coming in via stdin
if (!m_daemonMode) {
- m_input = new BufferedReader(new InputStreamReader(System.in));
+ try {
+ m_input = new ConsoleReader() ;
+ } catch (IOException e1) {
+ }
m_stdinInput = true;
input_string = "";
} else {
@@ -2770,7 +2772,7 @@ public class AgentMain {
File script = new File(getopt.getOptarg());
try {
- m_input = new BufferedReader(new FileReader(script));
+ m_input = new ConsoleReader(new FileInputStream(script), null);
m_stdinInput = false;
} catch (Exception e) {
throw new
IllegalArgumentException(MSG.getMsg(AgentI18NResourceKeys.BAD_INPUT_FILE, script, e));
diff --git
a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentUpdateThread.java
b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentUpdateThread.java
index 5bc2a8a..4d691c2 100644
---
a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentUpdateThread.java
+++
b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentUpdateThread.java
@@ -174,19 +174,7 @@ public class AgentUpdateThread extends Thread {
if (results.getError() != null) {
throw results.getError();
}
-
- // update has started! if this agent is running in non-daemon mode, kill
- // the input stream so the input thread knows to shutdown now
- try {
- BufferedReader in = this.agent.getIn();
- if (in != null) {
- System.in.close(); // we must ensure we close this directly!
- in.close();
- }
- } catch (Throwable t) {
- } finally {
- tryAgain = false;
- }
+ tryAgain = false;
} catch (Throwable t) {
showErrorMessage(AgentI18NResourceKeys.UPDATE_THREAD_EXCEPTION,
ThrowableUtil.getAllMessages(t));
diff --git a/modules/enterprise/remoting/cli/pom.xml
b/modules/enterprise/remoting/cli/pom.xml
index 6f1d556..b4adfee 100644
--- a/modules/enterprise/remoting/cli/pom.xml
+++ b/modules/enterprise/remoting/cli/pom.xml
@@ -20,8 +20,6 @@
<properties>
<scm.module.path>modules/enterprise/remoting/</scm.module.path>
-
- <jline.version>0.9.94</jline.version>
<i18nlog.version>1.0.9</i18nlog.version>
<log4j.version>1.2.14</log4j.version>
<persistence-api.version>1.0</persistence-api.version>
diff --git a/pom.xml b/pom.xml
index c5cfd44..3fab5d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,6 +74,7 @@
<postgresql.version>8.4-701.jdbc3</postgresql.version>
<h2.version>1.1.117</h2.version>
<jtds.version>1.2.2</jtds.version>
+ <jline.version>0.9.94</jline.version>
<richfaces.version>3.3.2.SR1</richfaces.version>
<sigar.version>1.6.3.82</sigar.version>
<quartz.version>1.6.5</quartz.version>
--
1.6.5.2
Show replies by date
Sure.... but where's the command autocompletion? ;)
+1 on push
-Greg
On Jan 29, 2010, at 3:13 PM, Bryan Kearney wrote:
---
I wanted the history more than anything.
--bk
On 01/29/2010 03:17 PM, Greg Hinkle wrote:
Sure.... but where's the command autocompletion? ;)
+1 on push
-Greg
On Jan 29, 2010, at 3:13 PM, Bryan Kearney wrote:
> ---
_______________________________________________
rhq-devel mailing list
rhq-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/rhq-devel
+1 on push as well
On 01/29/2010 03:17 PM, Greg Hinkle wrote:
Sure.... but where's the command autocompletion? ;)
+1 on push
-Greg
On Jan 29, 2010, at 3:13 PM, Bryan Kearney wrote:
> ---
>
_______________________________________________
rhq-devel mailing list
rhq-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/rhq-devel