cancel
Showing results for 
Search instead for 
Did you mean: 

How to Retrieve Connection properties at runtime by specifing SystemAlias

Former Member
0 Kudos

Hi Everybody,

Can anyone tell how to fetch the Connection properties like server name, repository name at runtime by Specifying the System Alias I have created in the Portal.

I have made a webService in which I am trying to connect to MDM ,using system Alias. I dont want to do any hard coding, To connect to MDM I need the following three parameters:

Server Name

Repository Name

Repository Port

if any body have tried it or have some clue about it, please let me know.

Even a small clue in this direction would be a great help.

Best Regards,

Namrta Mahajan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Namrata,

may be you can use ISystem class for this

Thanks

Ninad

Former Member
0 Kudos

Hi ninad,

Could you please tell me for ISystem Class which API's or Jar files I should refer?

As of now I am using MDMJava API's.

Thanks & Regards,

Namrta Mahajan

Former Member
0 Kudos

Hi Namrta,

you can find this class in jar <b>api_landscape_api.jar</b> this is not available in NDS plug ins so you have to ask basis people to search on server. or if you want give me your mail ID i will mail you this jar.

Thanks

Ninad

Former Member
0 Kudos

Hi ninad,

That would be a great help, Thanks

My email id is: mahajan.namrta@gmail.com

Do you have any sample code regarding this?

Regards,

Namrta Mahajan

Former Member
0 Kudos

Hi Namrta,

I mailed you jar file and found a sample code which I am giving bellow tell me if you have any problem.

ISystems systemSrv = (ISystems)PortalRuntime.getRuntimeResources().getService(ISystems.KEY);
String systemId= systemSrv.systemSrv.getSystemId("alias1");

Hashtable env =  
new

Hashtable(); 	env.put(Context.INITIAL_CONTEXT_FACTORY,IPcdContext.PCD_INITIAL_CONTEXT_FACTORY); env.put(IPcdContext.PCD_PERSONALIZATION_PRINCIPAL,

request.getUser()); env.put(Context.SECURITY_PRINCIPAL, request.getUser());
env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);

InitialContext iCtx = null;
try
{
	iCtx = new InitialContext(env);
	ISystem result =(ISystem)iCtx.lookup(sysId);
	            //get system attributes
	java.util.Enumeration enum = 
	   
	
	 result.getAttributeIds();  
				//get user mapping object 
	ISystemUserMappingData userMappingData =
	 result.getUserMappingData(user);  
}catch(javax.naming.NamingException e)

Thanks

Ninad

Answers (0)