Hi Edmund,

As I mentioned before extending the debugger popup menu works, now. So far I added:

* Copy Qualified Name

Copies the qualified job name to the clipboard.

* Job Log Explorer

Starts the job log explorer for the job that stopped at the breapoint

* Work With Spooled Files

Opens the "Work With Spooled Files" view for the job that stopped at the breapoint

These options are really helpful. But there are a few concerns that I hassle with:

a) Package '' com.ibm.debug.pdt.internal.*" is not exported and accessing the classes is discouraged.

b) There is no reliable method for retrieving the job name. The only options are calling either "DebuggeeProcess.getAttribute(null)" or "DebuggeeProcess.getLabel()". Both methods are private due to the restricted package access and I have to use a regular expression for retrieving the job name from the string returned.

c) The connection name is completely missing. All I have is the DNS name (or IP address) and the debugger port. Hence the only option I have to find the connection is spinning through all available connections looking for an active connection with a matching IP address.

It was over the top if you clould add the missing pieces to the attribute list of DebuggeProcess (actually IProcess) to ensure reliable information. That would also solve the "discouraged access" problem, because getAttribute(key) is part of the interface IProcess:

1) CONNECTION_NAME

2) QUALIFIED_JOB_NAME

Or instead of 2) three dedicated attributes:

2a) JOB_NAME
2b) JOB_USER
2c) JOB_NUMBER

This is nothing more than a question and of course I know that IBM cannot make money with that. I also know that it cannot be changed right now. But if it is not too hard for you, I may have a chance to refactor my classes to make them reliable and stable.

Regards,

Thomas

-----Ursprüngliche Nachricht-----
Von: WDSCI-L <wdsci-l-bounces@xxxxxxxxxxxxxxxxxx> Im Auftrag von Tools/400
Gesendet: Montag, 5. Oktober 2020 22:02
An: wdsci-l@xxxxxxxxxxxxxxxxxx
Betreff: Re: [WDSCI-L] How to get connection name from DebuggeeProcess?

Hi Edmund,

Thank you very much for your help and thank you very much to the debug developer. The information you provided did indeed help a lot to create the menu item action.

Now I can successfully open the iSphere "Job Log Explorer" view from the "Job" node of the call stack, when the debugger stops at a SEP.

I am just a little converned about that package "com.ibm.debug.pdt.internal.*" is not exported. So hopefully its classes will not be changed for the next years.

I also hope that I can rely on the following statements for retrieving the qualified job name:

private static final String PATTERN = "\\S*\\s+((\\d{6})/(.{1,10})/(.{1,10}))\\s+.*";

protected String getQualifiedJobName(IProcess process) {

Pattern pattern = Pattern.compile(PATTERN);
Matcher matcher = pattern.matcher(process.getAttribute(null));
if (matcher.find()) {
return matcher.group(1);
}

return null;
}

Now I am going to add an action for opening the iSphere "Work With Spooled Files" view to show the spooled files of the job.

Both items are on my wish list for a long time.

Best Regards,

Thomas.

Am 05.10.2020 um 17:20 schrieb Edmund Reinhardt:
Hello Thomas,
It looks like you are innovation and creating lots of new goodies which is
always welcome!
Here feedback from the debug developer on your questions
1)  The package com.ibm.debug.pdt.internal.core.model is actually exported
from the com.ibm.debug.pdt.core plugin. The user said it is not exported
probably because he did not add the plugin "com.ibm.debug.pdt.core" to
the Require-Bundle list in the MANIFEST.MF file of his own plugin. Please
add him to add com.ibm.debug.pdt.core as a Require-Bundle and try again.
2)  The user can use the base class PDTDebugTarget to access most of the
methods for PDT debug target. The connection label is a field of this
class. PDTDebugTarget is under the
package com.ibm.debug.pdt.internal.core, which is also exported from
plugin com.ibm.debug.pdt.core

I hope this helps you get the connections name and create your menu item
action.


______________________________________________________________________
________________


Edmund Reinhardt
905-413-3125
IBM Canada Ltd Rational Developer for i Access Client Solutions
Architect
[1]https://www.linkedin.com/in/edmundreinhardt/
[2]http://ibm.biz/rdi_hub [3]http://ibm.biz/IBMi_ACS





----- Original message -----
From: Tools/400 <thomas.raddatz@xxxxxxxxxxx>
Sent by: "WDSCI-L" <wdsci-l-bounces@xxxxxxxxxxxxxxxxxx>
To: wdsci-l@xxxxxxxxxxxxxxxxxx
Cc:
Subject: [EXTERNAL] [WDSCI-L] How to get connection name from
DebuggeeProcess?
Date: Sun, Oct 4, 2020 10:06 AM

Hi (IBM),

I already managed adding a menu entry to the popup menu of the "Debug"
view in order to start the "iSphere Job Log Explorer", when the debugger
stops at a service entry point:

   targetID="org.eclipse.debug.ui.DebugView"
   id="org.eclipse.debug.ui.debugview.popupMenu">

I also could retrieve the qualified job number from the IProcess
selected object (Last entry in den Debug view, e.g. "Process:
403007/QUSER/QZRCSRVS Program SPLF").

Hence I now have 1 out of 2 parameters that I need to open the Job Log
Explorer. The missing parameter is the connection name.

I can see, that IProcess is a DebuggeeProcess and that DebuggeeProcess
has an "fTarget" attribute. fTarget is a PICLDebugTarget class and has
an "fConnectionLabel" attribute. So that is close to the connection name
that I need.

Sadly I am stuck here. The problems I could not yet solve are:

a) com.ibm.debug.pdt.internal.core.model.DebuggeeProcess is not exported
and hence cannot be imported to the iSphere project.

b) The same thing applies to
com.ibm.debug.internal.pdt.PICLDebugTarget

c) Retrieving the connection name.

So the question is, how can I get the connection name at this point
(???):

public class OpenJobLogDebugPopupAction implements
IViewActionDelegate {

     private static final String PATTERN =
"\\S*\\s+((\\d{6})/(.{1,10})/(.{1,10}))\\s+.*";

     private Object shell;
     private IStructuredSelection structuredSelection;

     public void run(IAction arg0) {
         Object selectedObject = structuredSelection.getFirstElement();
         if (selectedObject instanceof IDebugElement) {
             IDebugElement debugElement = (IDebugElement)selectedObject;
             if (selectedObject instanceof IProcess) {
                 IProcess process = (IProcess)debugElement;
                 String connectionName = ???;
                 String qualifiedJobName = getQualifiedJobName(process);
                 if (!StringHelper.isNullOrEmpty(qualifiedJobName)) {
                     LoadRemoteJobLogJob job = new
LoadRemoteJobLogJob("iSphere", qualifiedJobName);
                     job.run();
                 }
             }
         }
     }

(The example above uses hard coded connection "iSphere".)

Regards,

Thomas.

--
This is the Rational Developer for IBM i   (WDSCI-L) mailing list
To post a message email: WDSCI-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: [4]https://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [5]https://archive.midrange.com/wdsci-l ;.

Help support midrange.com by shopping at amazon.com with our affiliate
link: [6]https://amazon.midrange.com




References

Visible links
1. https://www.linkedin.com/in/edmundreinhardt/
2. http://ibm.biz/rdi_hub
3. http://ibm.biz/IBMi_ACS
4. https://lists.midrange.com/mailman/listinfo/wdsci-l
5. https://archive.midrange.com/wdsci-l
6. https://amazon.midrange.com/



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.