cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Recover connexion data for a .jar file

ptc-4483298
1-Visitor

Recover connexion data for a .jar file

Hi,

I am developping a specific Jar file to enable an interface between Integrity and an other tool.

To use this jar file I have created a custom button.

This Jar works fine but I have to use a pop-up in which the user writes his connexion data (username, password, server and port). I would like to know if it is possible to recover the connexion data of the user who is currently using integrity.

Is there a way to do it or do we must asking the user each time he clik on this button his username, pasword.. even if he is already connected to Integrity.

And can we use the jar file in an other way that the custom button.

My "dream" should be to right clik on a Test Session, to clik on a specific line of the shortcut menu, recover the user connexion and the id of the Test Session and then do what the jar file have to do.

I hop to be clear.

Thank you !

Nico

ACCEPTED SOLUTION

Accepted Solutions

Hi Nico,

I agree with Joseph regarding the Custom Button command in the pulldown-menu.

Regarding the jar file, I assume you wrote the java code yourself and utilize the Integrity API?

If so, here's a code snippet I use for my java code.

I have a Session Manager Singleton that utililizes the current connection and session to create it's own CommandRunner.

I choose a singleton pattern to avoid concurrency problems.

When a jar file containing this is run from a Custom Button it does exactly what are looking for.

...
public class MKS_Session_Manager {
....
/**
* singleton that handles all MKS API calls to the via the client session
*/
private MKS_Session_Manager() {

// create an integration point
IntegrationPointFactory ipf = IntegrationPointFactory.getInstance();
IntegrationPoint mksIP;
Session mksSession;
try {
// get a local command runner
// Version of MKS 2007 is 4.9. ... so we choose the according parameters
mksIP = ipf.createLocalIntegrationPoint(4, 10);
mksSession = mksIP.getCommonSession();
cmdRunner = mksSession.createCmdRunner();
} catch (APIException apiEx) {
System.exit(1);
}
}

/**
* @return the one and only instance
*/
public static MKS_Session_Manager getInstance() {
if (instance == null) {
instance = new MKS_Session_Manager();
}
return instance;
}

/**

*

* @return The Command Runner to Use

*/

public CmdRunner getCmdRunner() {

return cmdRunner;

}

HTH Matthias

View solution in original post

2 REPLIES 2

Hello Nico,

I'm not sure if this is completely possible but I will help point you to a couple features of Integrity. For any custom button you can set this as an action for the right-click menu. Simply right-click to bring-up the menu and select "Customize This Menu...", click the blue plus sign and under the Custom menu drop-down, select your custom button action.

The next thing you can do is get the username and selected item ID from environment variables. For example, create a custom button action which simply runs "cmd.exe". Click the button when you have an item selected (eg. a Test Session) and you will see some environment variables which the Integrity Client uses, such as:

MKSSI_ISSUE0=1234 (Selected item)

MKSSI_USER=User123 (User login)

The part I am unsure of is whether the invoked JAR will have access to those environment variables. If so, it should be no problem to read and use them for your purposes. If you were to specify a text file in the custom button action in the "Environment File", this creates a dump of the client-specific environment variables. This may be easier for a Java JAR to read using FileIO methods rather than accessing Windows variables directly.

Hi Nico,

I agree with Joseph regarding the Custom Button command in the pulldown-menu.

Regarding the jar file, I assume you wrote the java code yourself and utilize the Integrity API?

If so, here's a code snippet I use for my java code.

I have a Session Manager Singleton that utililizes the current connection and session to create it's own CommandRunner.

I choose a singleton pattern to avoid concurrency problems.

When a jar file containing this is run from a Custom Button it does exactly what are looking for.

...
public class MKS_Session_Manager {
....
/**
* singleton that handles all MKS API calls to the via the client session
*/
private MKS_Session_Manager() {

// create an integration point
IntegrationPointFactory ipf = IntegrationPointFactory.getInstance();
IntegrationPoint mksIP;
Session mksSession;
try {
// get a local command runner
// Version of MKS 2007 is 4.9. ... so we choose the according parameters
mksIP = ipf.createLocalIntegrationPoint(4, 10);
mksSession = mksIP.getCommonSession();
cmdRunner = mksSession.createCmdRunner();
} catch (APIException apiEx) {
System.exit(1);
}
}

/**
* @return the one and only instance
*/
public static MKS_Session_Manager getInstance() {
if (instance == null) {
instance = new MKS_Session_Manager();
}
return instance;
}

/**

*

* @return The Command Runner to Use

*/

public CmdRunner getCmdRunner() {

return cmdRunner;

}

HTH Matthias

Announcements


Top Tags