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 96065 Details for
Bug 223385
Process's UUID is returned null
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.
[patch]
Make query method private instead of public
223385 patch.txt (text/plain), 14.26 KB, created by
Bing Xu
on 2008-04-15 09:29:50 EDT
(
hide
)
Description:
Make query method private instead of public
Filename:
MIME Type:
Creator:
Bing Xu
Created:
2008-04-15 09:29:50 EDT
Size:
14.26 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.platform.execution >Index: src/org/eclipse/tptp/platform/execution/client/core/internal/AgentController.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.execution/src/org/eclipse/tptp/platform/execution/client/core/internal/AgentController.java,v >retrieving revision 1.35 >diff -u -r1.35 AgentController.java >--- src/org/eclipse/tptp/platform/execution/client/core/internal/AgentController.java 12 Dec 2007 09:12:16 -0000 1.35 >+++ src/org/eclipse/tptp/platform/execution/client/core/internal/AgentController.java 15 Apr 2008 13:28:51 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2007 IBM, Intel Corporation. >+ * Copyright (c) 2005, 2008 IBM, Intel Corporation. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -98,6 +98,11 @@ > this.TPTP_AC = newAC; > } > >+ //223385 >+ public boolean isTPTP_AC() >+ { >+ return TPTP_AC; >+ } > /* (non-Javadoc) > * @see org.eclipse.tptp.platform.execution.core.IAgentController#getVersion() > */ >@@ -922,7 +927,7 @@ > _agentList.put(pkey, arr); > } > return arr.add(agent); >- } >+ } > > public IAgent[] queryRunningAgents(String agentName, String[] interfaceID, long pid) throws NotConnectedException { > if(!isConnected()) throw new NotConnectedException(Constants.TPTP_PLATFORM_EXEC_MSG17); >Index: src/org/eclipse/tptp/platform/execution/client/core/internal/ProcessImpl.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.execution/src/org/eclipse/tptp/platform/execution/client/core/internal/ProcessImpl.java,v >retrieving revision 1.25 >diff -u -r1.25 ProcessImpl.java >--- src/org/eclipse/tptp/platform/execution/client/core/internal/ProcessImpl.java 11 Dec 2007 11:34:17 -0000 1.25 >+++ src/org/eclipse/tptp/platform/execution/client/core/internal/ProcessImpl.java 15 Apr 2008 13:28:51 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2007 IBM Corporation, Intel Corporation. >+ * Copyright (c) 2005, 2008 IBM Corporation, Intel Corporation. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -13,7 +13,9 @@ > *******************************************************************************/ > package org.eclipse.tptp.platform.execution.client.core.internal; > >+import java.io.IOException; > import java.util.Collection; >+import java.util.Enumeration; > import java.util.HashMap; > import java.util.HashSet; > import java.util.Hashtable; >@@ -21,27 +23,30 @@ > import java.util.Map; > import java.util.Set; > import java.util.Vector; >-import java.util.Enumeration; >-import java.io.IOException; > > import org.eclipse.tptp.platform.execution.client.agent.IAgent; > import org.eclipse.tptp.platform.execution.client.agent.internal.AgentImpl; >-import org.eclipse.tptp.platform.execution.client.core.*; >-import org.eclipse.tptp.platform.execution.client.core.internal.AgentController; >-import org.eclipse.tptp.platform.execution.client.core.internal.ConsoleDataProcessor; >-import org.eclipse.tptp.platform.execution.client.core.internal.ConsoleImpl; >+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.INode; >+import org.eclipse.tptp.platform.execution.client.core.IProcess; >+import org.eclipse.tptp.platform.execution.client.core.internal.commands.GetProcessUUIDCommand; > import org.eclipse.tptp.platform.execution.client.core.internal.commands.LaunchProcessCommand; >-import org.eclipse.tptp.platform.execution.util.*; >-import org.eclipse.tptp.platform.execution.util.internal.CommandFragment; >-import org.eclipse.tptp.platform.execution.util.internal.Constants; >-import org.eclipse.tptp.platform.execution.util.internal.TPTPXMLParse; > import org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException; > import org.eclipse.tptp.platform.execution.exceptions.InactiveProcessException; >-import org.eclipse.tptp.platform.execution.exceptions.TimeoutException; > import org.eclipse.tptp.platform.execution.exceptions.NoSuchApplicationException; > import org.eclipse.tptp.platform.execution.exceptions.NotConnectedException; >-import org.eclipse.tptp.platform.execution.exceptions.ProcessActiveException; > import org.eclipse.tptp.platform.execution.exceptions.NotSupportedException; >+import org.eclipse.tptp.platform.execution.exceptions.ProcessActiveException; >+import org.eclipse.tptp.platform.execution.exceptions.TimeoutException; >+import org.eclipse.tptp.platform.execution.util.ICommandElement; >+import org.eclipse.tptp.platform.execution.util.ICommandHandler; >+import org.eclipse.tptp.platform.execution.util.TPTPAgentAccess; >+import org.eclipse.tptp.platform.execution.util.Variable; >+import org.eclipse.tptp.platform.execution.util.internal.CommandFragment; >+import org.eclipse.tptp.platform.execution.util.internal.Constants; >+import org.eclipse.tptp.platform.execution.util.internal.TPTPXMLParse; > > public class ProcessImpl implements IProcess,IConnectionListener, Runnable { > >@@ -349,12 +354,107 @@ > { > return _processInfo.getProcessName(); > } >+ >+ //223385 >+ /** >+ * >+ * return UUID of process or null. >+ */ >+ private String queryProcessUUID(long pid, int destID) throws NotConnectedException { >+ AgentController ac; >+ try{ >+ ac = (AgentController) _ac; >+ }catch(ClassCastException e){ >+ return null; >+ } >+ >+ if(! ac.isConnected()) throw new NotConnectedException(Constants.TPTP_PLATFORM_EXEC_MSG17); >+ >+ final Object _launcherLock = new Object(); >+ >+ final GenericCommandHandler genCmdHandler = new GenericCommandHandler(); >+ if(ac.isTPTP_AC()){ >+ try{ >+ synchronized(_launcherLock){ >+ try{ >+ GetProcessUUIDCommand command= new GetProcessUUIDCommand(pid+""); >+ >+ ac.sendCommand(command.buildCommand(), destID, new ICommandHandler() >+ { >+ public void incomingCommand(INode node, ICommandElement command) >+ { >+ genCmdHandler.setCommandElement(command); >+ } >+ }); >+ try{ >+ _launcherLock.notifyAll(); >+ }catch(Exception e){ >+ e.printStackTrace();} >+ } >+ catch(Exception e){e.printStackTrace();} >+ } //synchronized >+ }catch(Exception e){ >+ e.printStackTrace();} >+ } >+ >+ synchronized (_launcherLock) { >+ int processLauchTimeOut = 0; >+ while(genCmdHandler.getCommandElement() == null ) >+ { >+ try >+ { >+ _launcherLock.wait(Constants.TIMEOUT_PERIOD); >+ if (processLauchTimeOut == Constants.PROCESS_LAUNCH_TIMEOUT_TRY_COUNT) >+ { >+ throw new TimeoutException(Constants.TPTP_PLATFORM_EXEC_MSG33); >+ } >+ processLauchTimeOut++; >+ if (Constants.TPTP_DEBUG) System.out.println("The Process Launch Timeout count" + processLauchTimeOut); >+ } >+ catch(Exception e) >+ { >+ _launcherLock.notifyAll(); >+ e.printStackTrace(); >+ break; >+ } >+ } >+ _launcherLock.notifyAll(); >+ } >+ >+ >+ if (genCmdHandler.getCommandElement() == null) { >+ return null; >+ } >+ String commandStr = ((CommandFragment)genCmdHandler.getCommandElement()).getCommandData(); >+ >+ TPTPXMLParse ParseObj = new TPTPXMLParse(); >+ ParseObj.setParser(commandStr); >+ >+ Hashtable ch = ParseObj.getHashTable(); >+ if(ch.containsKey("processUUID") ){ >+ return (String) ch.get("processUUID"); >+ }else{ >+ return null; >+ } >+ } >+ > > /* (non-Javadoc) > * @see org.eclipse.tptp.platform.execution.core.IProcess#getUUID() > */ > public String getUUID() > { >+ //223385 >+ try{ >+ if(this._UUID == null){ >+ >+ this._UUID = queryProcessUUID(getProcessId(), getDestID()); >+ } >+ }catch(InactiveAgentException e){ e.printStackTrace(); >+ }catch(InactiveProcessException e){ e.printStackTrace(); >+ }catch(NotConnectedException e){ e.printStackTrace(); >+ } >+ > return this._UUID; > } > >@@ -905,6 +1005,10 @@ > if(s != null) { > long processId = Long.parseLong(s); > process.setProcessId(processId); >+ >+ //223385 >+ process._UUID = (String) commandHash.get("processUUID"); >+ > ((AgentController)(process._ac)).attachProcess(process); > } > } >Index: src/org/eclipse/tptp/platform/execution/client/core/internal/commands/GetProcessUUIDCommand.java >=================================================================== >RCS file: src/org/eclipse/tptp/platform/execution/client/core/internal/commands/GetProcessUUIDCommand.java >diff -N src/org/eclipse/tptp/platform/execution/client/core/internal/commands/GetProcessUUIDCommand.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/platform/execution/client/core/internal/commands/GetProcessUUIDCommand.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,158 @@ >+/******************************************************************************* >+ * Copyright (c) 2005, 2008 IBM Corporation, Intel Corporation. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - Initial API and implementation >+ * >+ * $Id$ >+ *******************************************************************************/ >+ >+package org.eclipse.tptp.platform.execution.client.core.internal.commands; >+ >+import java.util.Enumeration; >+ >+import org.eclipse.tptp.platform.execution.util.*; >+ >+import org.eclipse.tptp.platform.execution.exceptions.ProcessActiveException; >+import org.eclipse.tptp.platform.execution.util.internal.CommandElement; >+import org.eclipse.tptp.platform.execution.util.internal.Constants; >+import org.eclipse.tptp.platform.execution.util.internal.TPTPMessageUtil; >+import org.eclipse.tptp.platform.execution.util.internal.TPTPString; >+import org.eclipse.tptp.platform.execution.util.internal.TPTPXMLParse; >+ >+/** >+ * >+ * TODO To change the template for this generated type comment go to >+ * Window - Preferences - Java - Code Style - Code Templates >+ */ >+public class GetProcessUUIDCommand extends CommandElement { >+ >+ protected String _processID = null; >+ protected String _commandData= null; >+ >+ public GetProcessUUIDCommand(String processID) >+ { >+ this._commandData = new String(); >+ this._processID = processID; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.platform.execution.core.ICommandElement#getSize() >+ */ >+ public int getSize() >+ { >+ return 0; >+ } >+ public long getContext() >+ { >+ return _context; >+ } >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.platform.execution.core.ICommandElement#setContextID(java.lang.String) >+ */ >+ public void setContext(long contextID) { >+ _context = contextID; >+ } >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.platform.execution.core.ICommandElement#getSrcID() >+ */ >+ public long getSource() { >+ return _src; >+ } >+ public void setCommandData(String command) { >+ this._commandData = new String(command); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.platform.execution.core.impl.commands.QueryRunningAgentsCommand#getCommandData() >+ */ >+ public String getCommandData() { >+ return this._commandData; >+ } >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.platform.execution.core.ICommandElement#setSrcID(java.lang.String) >+ */ >+ public void setSource(long srcID) { >+ _src = srcID; >+ } >+ //No TAG for TPTP 4.0 >+ public long getTag() { >+ return _tag; >+ } >+ >+ >+ public long getDestination() { >+ return _dest; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.platform.execution.core.ICommandElement#getInterfaceID() >+ */ >+ public String getInterfaceID() { >+ return _iid; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.platform.execution.core.ICommandElement#setInterfaceID(java.lang.String) >+ */ >+ public void setInterfaceID(String interfaceID) { >+ _iid = interfaceID; >+ } >+ >+ public void setDestination(long dest) { >+ _dest=dest; >+ } >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.platform.execution.core.ICommandElement#buildCommand(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) >+ */ >+ public String buildCommand() >+ { >+ StringBuffer sbuf = new StringBuffer(); >+ //<Cmd src= ctxt= dest= ><></Cmd> >+ >+ sbuf.append("<getProcessUUID iid=\""+Constants.PROC_CTLR_IID+"\">"); >+ sbuf.append("<processID>"); >+ sbuf.append(this._processID); >+ sbuf.append("</processID></getProcessUUID>"); >+ >+ this._commandData = sbuf.toString(); >+ return sbuf.toString(); >+ } >+ >+ >+ /** >+ * Read the command from the input buffer. >+ * @return int >+ * @param buffer byte[] >+ * @param offset int >+ */ >+ public int readFromBuffer(byte[] buffer, int offset) >+ { >+ int current=offset; >+ String retStr = null; >+ current=TPTPMessageUtil.readTPTPStringFromBuffer(buffer, current, new TPTPString(retStr)); >+ //With the retStr value received parse the output for the specific elements >+ TPTPXMLParse ParseObj = new TPTPXMLParse(); >+ ParseObj.setParser(retStr); >+ Enumeration enumer = ParseObj.getHashTable().elements(); >+ >+ return current; >+ } >+ /** >+ * Write the XML Command to the input buffer. >+ * @return int >+ * @param buffer byte[] >+ * @param offset int >+ */ >+ public int writeToBuffer(byte[] buffer, int offset) >+ { >+ int current=offset; >+ current=TPTPMessageUtil.writeTPTPStringToBuffer(buffer, current, new TPTPString(buildCommand())); >+ return current; >+ } >+ >+}
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 223385
:
93497
|
95929
| 96065