Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 55247 Details for
Bug 165948
Launching a process fails
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Client test application
Test.java (text/plain), 5.58 KB, created by
Michael Spivak-Baranov
on 2006-12-07 11:29:31 EST
(
hide
)
Description:
Client test application
Filename:
MIME Type:
Creator:
Michael Spivak-Baranov
Created:
2006-12-07 11:29:31 EST
Size:
5.58 KB
patch
obsolete
>package com.intel.vtune.test; > >import org.eclipse.tptp.platform.execution.client.core.ConnectionInfo; >import org.eclipse.tptp.platform.execution.client.core.IAgentController; >import org.eclipse.tptp.platform.execution.client.core.IConsole; >import org.eclipse.tptp.platform.execution.client.core.IDataProcessor; >import org.eclipse.tptp.platform.execution.client.core.IFileTransferManager; >import org.eclipse.tptp.platform.execution.client.core.INode; >import org.eclipse.tptp.platform.execution.client.core.IProcess; >import org.eclipse.tptp.platform.execution.client.core.NodeFactory; >import org.eclipse.tptp.platform.execution.client.core.internal.IProcessListener; >import org.eclipse.tptp.platform.execution.util.ICommandElement; >import org.eclipse.tptp.platform.execution.util.ICommandHandler; >import org.eclipse.tptp.platform.execution.util.internal.CommandFragment; > >import java.net.UnknownHostException; > >import java.io.IOException; > > >public class Test { > > private IAgentController m_agentController = null; > > public void run(String[] args) throws Exception > { > INode node = null; > ConnectionInfo connectionInfo = new ConnectionInfo(); > > String host = "localhost"; > int port = 10006; > connectionInfo.setHostName(host); > connectionInfo.setPort(port); > > try > { > node = NodeFactory.createNode(host); > } > catch(UnknownHostException ex) > { > String msg = ex.getMessage(); > System.out.println(msg); > return; > } > > if (node != null) > { > System.out.println("Connecting to AC.."); > try > { > m_agentController = node.connect(connectionInfo); > } > catch(Exception ex) > { > String msg = ex.getMessage(); > System.out.println(msg); > return; > } > > } > else > { > String msg = "Error occurred while creating the Node for " + host; > System.out.println(msg); > return; > } >// Test1(); > Test2(); >// Test3(); > } > > private void Test1() > { > System.out.println("getting FileTransferManager..."); > IFileTransferManager iftm = m_agentController.getFileTransferManager(); > System.out.println("getting FileTransferManager - done"); > String fullSrc, fullDst; > fullSrc = "d:\\temp\\444\\1\\NNECBuildLog.log"; > fullDst = "d:\\temp\\444\\NNECBuildLog.log"; > try > { > iftm.getFile(fullDst, fullSrc); > } > catch(IOException ex) > { > > } > } > > private void handleCommand(ICommandElement command) > { > String commandStr = new String(((CommandFragment)command).getCommandData()); > System.out.println("EventListener - Command: " + commandStr); > } > > private void Test2() > { > final IProcess process = m_agentController.createProcess(); > > try > { > process.setLocation("."); > process.setExecutable("d:\\temp\\1.bat"); > boolean b = process.validateProcessToLaunch(); > System.out.println("Valid: " + b); > > IConsole console = process.getConsole(); > IDataProcessor dataProcessor = new IDataProcessor() { > public void incomingData(byte[] buffer, int length, java.net.InetAddress peer) > { > String s = new String(buffer); > System.out.print(s); > } > > public void incomingData(char[] buffer, int length, java.net.InetAddress peer) > { > String s = new String(buffer); > System.out.print(s); > } > > public void invalidDataType(byte[] data, int length, java.net.InetAddress peer) > { > String s = new String(data); > System.out.print("Invalid data type: " + s); > } > > public void waitingForData() > { > System.out.println("Wating for data"); > } > }; > > console.setDataProcessor(dataProcessor); > > process.addProcessListener(new IProcessListener() > { > public void processExited(IProcess _process) > { > System.out.println("ProcessListener: Process exited."); > synchronized(process){ > process.notify(); > } > } > > public void processLaunched(IProcess _process) > { > System.out.println("ProcessListener: Process launched."); > synchronized(process){ >// process.notify(); > } > } > }); > > process.launch(); > > long pid = process.getProcessId(); > System.out.println("PID: " + pid); > > //If the process launch is successful read and write to the console > if(console.getDataProcessor() != null && process.getProcessId() > 0) > { > for(int i = 0; i < 10; i ++) > { > StringBuffer buf = new StringBuffer(); > for(int ii = 0; ii < 10; ii ++) > { > buf.append("Write from the client \n"); > } > console.write(buf.toString()); > console.write("\n"); > } > } > synchronized(process) > { > process.wait(); // waiting for the "process exited" event > } > } > catch(Exception ex) > { > String msg = ex.getMessage(); > System.out.println(msg); > return; > } > } > > private void Test3() > { > final IProcess process = m_agentController.createProcess(); > > try > { > process.setLocation("."); > process.setExecutable("d:\\temp\\1.bat"); > boolean b = process.validateProcessToLaunch(); > System.out.println("Valid: " + b); > > m_agentController.addEventListener("org.eclipse.tptp.processController", new ICommandHandler() > { > public void incomingCommand(INode node, ICommandElement command) > { > handleCommand(command); > } > }); > > process.launch(); > > long pid = process.getProcessId(); > System.out.println("PID: " + pid); > } > catch(Exception ex) > { > String msg = ex.getMessage(); > System.out.println(msg); > return; > } > } > > public static void main(String[] args) { > try > { > new Test().run(args); > } > catch(Exception e) > { > e.printStackTrace(); > } > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 165948
:
55240
|
55241
|
55242
|
55243
|
55244
|
55245
|
55246
| 55247 |
57719
|
58241
|
58962