on 06-13-2008 7:24 AM
Hi
I would like that someone provide my the code to set a connection with MDM through the MDM Java APIS SP6 Patch2. I need to connect with the repository, and authentificate the User and the Password. Furthermore I would need the code to pick up events like add record and modified record. When a record is added or modified is neccesary to pick up the value of a lookup field in the main table to check that this value is a specific value in order to syndicate this record. That´s possible that someone provide this code to me.
thanks in advance. If the reply is useful there will be rewards Points.
not worked on SP6 yet, but if it is same for SP5, i can provide the code for create and authenticate user session.
Will that do?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
String serverName = SERVERNAME;
connection = ConnectionPoolFactory.getInstance(serverName);
// specify the repository to use
// alternatively, a repository identifier can be obtain from the GetMountedRepositoryListCommand
String repositoryName = FTPSiteProperties.REPOSITORYNAME;
String dbmsName = FTPSiteProperties.DBSERVER;
reposId = new RepositoryIdentifier(repositoryName, dbmsName, DBMSType.MS_SQL);
// get list of available regions for the repository
GetRepositoryRegionListCommand regionListCommand =
new GetRepositoryRegionListCommand(connection);
regionListCommand.setRepositoryIdentifier(reposId);
regionListCommand.execute();
RegionProperties[] regions = regionListCommand.getRegions();
// create a user session
CreateUserSessionCommand sessionCommand =
new CreateUserSessionCommand(connection);
sessionCommand.setRepositoryIdentifier(reposId);
sessionCommand.setDataRegion(regions[0]); // use the first region
sessionCommand.execute();
sessionId = sessionCommand.getUserSession();
// authenticate the user session
String userName = FTPSiteProperties.USER;
String userPassword = FTPSiteProperties.PASSWORD;
AuthenticateUserSessionCommand authCommand =
new AuthenticateUserSessionCommand(connection);
authCommand.setSession(sessionId);
authCommand.setUserName(userName);
authCommand.setUserPassword(userPassword);
authCommand.execute();
}
catch(Exception e){
e.printStackTrace();
}
Hope This helps
Edited by: Nitin Mahajan on Jun 13, 2008 1:29 PM
Hi,
Check this out
ConnectionAccessor simpleConnection=null;
RepositorySchema repSchema=null;
RepositoryIdentifier repIdentifier=null;
DBMSType dbmsType = DBMSType.MS_SQL;
String session=null;
String connection = "MDM_SERVER_PROD";
String repository = "TEST_REP";
simpleConnection = SimpleConnectionFactory.getInstance(connection);
repIdentifier = new RepositoryIdentifier(repository, connection, dbmsType);
RegionProperties dataRegion = getRegion();
CreateUserSessionCommand createUSesCmd = new CreateUserSessionCommand(simpleConnection);
createUSesCmd.setDataRegion(dataRegion);
createUSesCmd.setRepositoryIdentifier(repIdentifier);
createUSesCmd.execute();
session = createUSesCmd.getUserSession();
AuthenticateUserSessionCommand authUSesCmd = new AuthenticateUserSessionCommand(simpleConnection);
authUSesCmd.setSession(session);
authUSesCmd.setUserName("Admin");
authUSesCmd.setUserPassword("pass123");
authUSesCmd.execute();
GetRepositorySchemaCommand getRepSchCmd = new GetRepositorySchemaCommand(simpleConnection);
getRepSchCmd.setSession(session);
getRepSchCmd.execute();
Just put all the execute statements within try catch block
Regards,
Jitesh Talreja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.