Commit 9b1f17ee authored by afreyssin's avatar afreyssin

Adds classic.JoramAdmin class.

parent d815ab42
......@@ -71,6 +71,9 @@
<copy file="${a3.conf}" tofile="${run.dir}/server${sid}/a3servers.xml"/>
<copy file="${osgi.conf}" tofile="${run.dir}/server${sid}/config.properties"/>
<!--copy file="${monit.conf}" tofile="${run.dir}/server${sid}/MonitoringConfig.xml"/-->
<!-- copy file="${conf.dir}/fileMonitoring.props" tofile="${run.dir}/server${sid}/fileMonitoring.props"/ -->
<!-- copy file="${conf.dir}/fileMonitoring.props" tofile="${run.dir}/server${sid}/logMonitoring.props"/ -->
<!-- copy file="${conf.dir}/fileMonitoring.props" tofile="${run.dir}/server${sid}/windowMonitoring.props"/ -->
</target>
<target name="simple_init" depends="init">
......@@ -83,6 +86,7 @@
failonerror="no" fork="yes"
dir="${run.dir}/server${sid}">
<classpath path="${felix.class.path}"/>
<!-- jvmarg line="-Dfelix.config.properties=file:config.properties -Dfr.dyade.aaa.agent.AgentServer.id=${sid} -Dcom.sun.management.jmxremote.port=9191 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -DTransaction.SyncOnWrite=false"/ -->
<jvmarg line="-server -Xmx2G -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=5000,suspend=n -Dfelix.config.properties=file:config.properties -Dfr.dyade.aaa.agent.AgentServer.id=${sid} -Dcom.sun.management.jmxremote -DTransaction.SyncOnWrite=false"/>
<!-- jvmarg line="-server -Xmx1500m -Xincgc -Dfelix.config.properties=file:config.properties -Dfr.dyade.aaa.agent.AgentServer.id=${sid} -Dcom.sun.management.jmxremote"/ -->
<!-- jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y"/ -->
......@@ -245,6 +249,19 @@
* Classic Sample
************************************************** -->
<!-- Runs the JoramAdmin class -->
<target name="joram_admin" depends="simple_init"
description="--> Runs the JoramAdmin with shutdown command">
<java classname="classic.JoramAdmin"
failonerror="no" fork="yes"
dir="${run.dir}">
<classpath path="${project.class.path}"/>
<arg value="localhost"/>
<arg value="6666"/>
<arg value="shutdown"/>
</java>
</target>
<!-- Setup the classic configuration -->
<target name="classic_admin" depends="simple_init"
description="--> Runs administration code for classic sample (centralized architecture)">
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2013 ScalAgent Distributed Technologies
* Copyright (C) 2004 - Bull SA
* Copyright (C) 1996 - 2000 Dyade
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): ScalAgent Distributed Technologies
* Contributor(s):
*/
package classic;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
public class JoramAdmin {
final static String PROMPT = "-> ";
public static void main(String[] args) throws IOException {
Socket socket = null;
PrintWriter out = null;
BufferedReader in = null;
try {
if (args.length == 3) {
String hostname = args[0];
int port = Integer.parseInt(args[1]);
String command = args[2];
try {
socket = new Socket(hostname, port);
out = new PrintWriter(socket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
} catch (IOException e) {
return;
}
out.println(command);
out.println("\004");
String line;
do {
line = in.readLine();
if ((line != null) && (! line.startsWith(PROMPT)))
System.out.println(line);
} while (line != null);
} else {
System.out.println("usage: java ... classic.JoramAdmin <host> <port> <command>");
}
} catch (Exception exc) {
System.out.println("usage: java ... classic.JoramAdmin <host> <port> <command>");
exc.printStackTrace();
} finally {
if (out != null) out.close();
if (in != null) in.close();
if (socket != null) socket.close();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment