private DataElement getSendInputDescriptor(DataElement remoteObject) { if (_sendInputDescriptor == null || _dataStore != remoteObject.getDataStore()) { _sendInputDescriptor = _dataStore.findCommandDescriptor(DataStoreSchema.C_SEND_INPUT); } return _sendInputDescriptor; }
public void exit() { // send cancel command DataElement command = _status.getParent(); DataStore dataStore = command.getDataStore(); DataElement cmdDescriptor = command.getDescriptor(); DataElement cancelDescriptor = dataStore.localDescriptorQuery(cmdDescriptor, "C_CANCEL"); // $NON-NLS-1$ if (cancelDescriptor != null) { dataStore.command(cancelDescriptor, command); } _status.setAttribute(DE.A_VALUE, "done"); // $NON-NLS-1$ _stdoutHandler.finish(); _stderrHandler.finish(); }
@SuppressWarnings("restriction") public DStoreHostShell( DStoreStatusMonitor statusMonitor, DataElement status, DataStore dataStore, String initialWorkingDirectory, String invocation, String encoding, String[] environment, boolean redirectStderr) { _dataStore = dataStore; // make this subsystem a communications listener DataElement contextDir = dataStore.createObject( null, "directory", (new File(initialWorkingDirectory)).getName(), initialWorkingDirectory); //$NON-NLS-1$ dataStore.setObject(contextDir); _status = status; if (redirectStderr) { // we redirect stderr to stdout using our own hacked up copy of DStoreShellOutputReader _stdoutHandler = new DStoreShellOutputReader(this, _status, false); _stderrHandler = null; } else { // use normal RSE stuff _stdoutHandler = new org.eclipse.rse.internal.services.dstore.shells.DStoreShellOutputReader( this, _status, false); _stderrHandler = new org.eclipse.rse.internal.services.dstore.shells.DStoreShellOutputReader( this, _status, true); } _statusMonitor = statusMonitor; }
public void writeToShell(String command) { DataElement commandElement = _status.getParent(); DataStore dataStore = commandElement.getDataStore(); if (command.equals("") || command.equals("#break")) // $NON-NLS-1$ //$NON-NLS-2$ { String cmd = command; if (cmd.equals("")) // $NON-NLS-1$ cmd = "#enter"; // $NON-NLS-1$ DataElement commandDescriptor = getSendInputDescriptor(commandElement); if (commandDescriptor != null) { DataElement in = dataStore.createObject(null, "input", cmd); // $NON-NLS-1$ dataStore.command(commandDescriptor, in, commandElement); } } else { String[] tokens = command.split("\n\r"); // $NON-NLS-1$ for (int i = 0; i < tokens.length; i++) { String cmd = tokens[i]; if (cmd != null) { // first, find out if the server support conversion DataElement fsD = dataStore.findObjectDescriptor(DataStoreResources.model_directory); DataElement convDes = dataStore.localDescriptorQuery(fsD, "C_CHAR_CONVERSION", 1); // $NON-NLS-1$ if (convDes != null) { if (!_sentCharConversionCommand) { dataStore.command(convDes, _status); _sentCharConversionCommand = true; } cmd = convertSpecialCharacters(cmd); } DataElement commandDescriptor = getSendInputDescriptor(commandElement); if (commandDescriptor != null) { DataElement in = dataStore.createObject(null, "input", cmd); // $NON-NLS-1$ dataStore.command(commandDescriptor, in, commandElement); } } } } }