use of org.python.util.InteractiveConsole in project netxms by netxms.
the class Shell method run.
/**
* @param args
* @throws IOException
* @throws NetXMSClientException
*/
private void run(String[] args) throws IOException, NXCException {
initJython(args);
readCredentials((args.length == 0) && isInteractive());
final NXCSession session = connect();
final InteractiveConsole console = createInterpreter(args);
console.set("session", session);
console.set("s", session);
if (args.length == 0) {
console.interact(getBanner(), null);
} else {
console.execfile(args[0]);
}
console.cleanup();
session.disconnect();
}
use of org.python.util.InteractiveConsole in project netxms by netxms.
the class Shell method createInterpreter.
/**
* @param args
* @return
*/
private InteractiveConsole createInterpreter(String[] args) {
PySystemState systemState = Py.getSystemState();
final InteractiveConsole console;
if (!isInteractive()) {
systemState.ps1 = systemState.ps2 = Py.EmptyString;
}
console = new InteractiveConsole();
Py.getSystemState().__setattr__("_jy_interpreter", Py.java2py(console));
imp.load("site");
console.exec("from org.netxms.client import *");
console.exec("from org.netxms.client.agent.config import *");
console.exec("from org.netxms.client.constants import *");
console.exec("from org.netxms.client.dashboards import *");
console.exec("from org.netxms.client.datacollection import *");
console.exec("from org.netxms.client.events import *");
console.exec("from org.netxms.client.log import *");
console.exec("from org.netxms.client.maps import *");
console.exec("from org.netxms.client.maps.configs import *");
console.exec("from org.netxms.client.maps.elements import *");
console.exec("from org.netxms.client.market import *");
console.exec("from org.netxms.client.mt import *");
console.exec("from org.netxms.client.objects import *");
console.exec("from org.netxms.client.objecttools import *");
console.exec("from org.netxms.client.packages import *");
console.exec("from org.netxms.client.reporting import *");
console.exec("from org.netxms.client.server import *");
console.exec("from org.netxms.client.services import *");
console.exec("from org.netxms.client.snmp import *");
console.exec("from org.netxms.client.topology import *");
console.exec("from org.netxms.client.users import *");
console.exec("from org.netxms.client.xml import *");
console.exec("from org.netxms.client.zeromq import *");
console.set("__name__", "__nxshell__");
return console;
}
Aggregations