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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Using J-link to Register Server

byork
17-Peridot

Using J-link to Register Server

I was wondering if anybody would be willing to share an example where they used J-Link to register a new server?

Thanks in advance!

5 REPLIES 5
Eike_Hauptmann
13-Aquamarine
(To:byork)

I don't think that this is a good idea. So for multiple reasons a server change with all backgroundjobs could get you some mess inside the data directories.

 

Anyway, if you want to do it it's straight forward:

String pdmServerData = "Name;;;URL;;;USERNAME;;;PASSWORD;;;WORKSPACE"

String[] psd = pdmServerData.split(";;;"); //NOI18N

boolean mknew = true;
Servers servers = session.ListServers();
if (servers != null) {
String servername = psd[0];
for (int i = 0; i < servers.getarraysize(); i++) {
if (servername.equals(servers.get(i).GetAlias().toLowerCase())) {
mknew = false;
servers.get(i).Activate();
}
}
}
if (mknew) {
session.RegisterServer(psd[0], psd[1], pdmServer.charAt(2) == '1' ? psd[4] : null);
}

Eike,

 

Can you help me understand why it's not a good idea?   What I'm looking to do is for new installs, create an easy way to register the production PDMLink server.  Is there be a better way?

 

Thanks!

 

 

Eike_Hauptmann
13-Aquamarine
(To:byork)

If there is a better way is a difficult question. No official PTC supported afaik.

 

I don't know how our products do this. But I think a better way is to start with the right server and an empty workspace. So I know that this could cause problems in the past if you change servers and have a good filled workspace from another server synced to your mashine, ... . But I don't know for sure if that are problems today.

 

I have also played around with the JLINK register functions and mostly it was ok to do connection handling (username + password) and no server registration. But the case was another.

 

Br,

Eike

jmikesell
15-Moonstone
(To:byork)

I do ours with a trail file. There is a batch file that builds the user environment (pulls configs, .psf, start parts, material, etc to the local machine from the network) then check to see if a server is registerd. If there is no registered server it runs a trail file that gets you to the point of logging into windchill, so it populates the server name box, etc.

Echo Launching Pro/E
	IF exist "%PTC_WF_ROOT%\.Settings\config.fld" (
		START "" "%DIR_PROE_BIN%\parametric.exe"
	) ELSE (
		XCOPY "%DIR_PROE_CONFIG_BIN%\registerserver.txt" "%DIR_PROE_DATA%\" /Q /R /H /I /Y
		"%DIR_PROE_BIN%\parametric.exe" "%DIR_PROE_DATA%\registerserver.txt"
	

 

byork
17-Peridot
(To:byork)

 

Here is what I ultimatly went with.  Seems to work pretty well.  
Thanks to @Eike_Hauptmann and @jmikesell for helping out.

public String isConnected(){ try { Server activeServer = session.GetActiveServer(); printLog("isConnected: " + activeServer); String severList =""; Servers servers =null; servers = session.ListServers(); //printLog("isConnected: number of Registered Servers Found = " + servers.getarraysize()); if(servers != null){ for(int i=0; i<servers.getarraysize(); i++){ Server server = (Server) servers.get(i); String serverName = server.GetAlias(); printLog("isConnected: Server name: " + serverName); serverName += serverName; severList = serverName; } } if(!severList.contains("pdm.server.com")){ printLog("isConnected: Production Server Not Found "); String macro = ""; printLog("RegServer Macro: Start"); macro += "~ Command `ProCmdUtilWebRegServ`;"; macro += "~ Select `siteregistrydialog` `MenuBar1`1 `ServerMenuPane`;"; macro += "~ Close `siteregistrydialog` `MenuBar1`;"; macro += "~ Activate `siteregistrydialog` `ServerRegisterNewPshBtn`;"; macro += "~ Input `registernewserverdlg` `NewServerNameIPanel` `pdm.server.com`;"; macro += "~ Update `registernewserverdlg` `NewServerNameIPanel` `pdm.server.com`;"; macro += "~ FocusOut `registernewserverdlg` `NewServerNameIPanel`;"; macro += "~ Input `registernewserverdlg` `NewServerLocationIPanel` `http://pdm.server.com/Windchill`;"; macro += "~ Update `registernewserverdlg` `NewServerLocationIPanel` `http://pdm.server.com//Windchill`;"; macro += "~ FocusOut `registernewserverdlg` `NewServerLocationIPanel`;"; macro += "~ Activate `registernewserverdlg` `NewServerCheckPshBtn`;"; session.RunMacro(macro); return "Yes"; }else{ printLog("isConnected: Production Server Found "); return ""; } }catch(Exception e){ StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); printLog("isConnected: " + sw.toString()); } return""; }

 

Top Tags