Documentum DFC

Introduction


Documentum dfc is a Java API for client and server communication .

The client side dfc program connects using RPC call to server 

side dfc program to read/write the resources from server .

While connecting dfc client programs first request for SessionManger which act as a container to manage the sessions , polling the session , session transaction operations.

From session Manger program gets the session to start the read/write operations .It is highly recommended to release the session after use as it keep the resources open until the session is open

Below are the example to create the dfc session sample.

Documentum DFC code..


Example to Create Session 



public class DocumentumSessionHandler {

public void login() throws DDfException {
 helper.setLogStr("user : "+userName +" Repository Name :"+repositoryName);
try {
  getIDfSession();
} catch (DDfException e) {
helper.setLogStr("Please check username and password " +e);
}
}


public IDfSession getIDfSession() throws DDfException {
if (iDfSession != null) {
return iDfSession;
}
try {
iDfSession = getIDfSessionManager().getSession(repositoryName);
} catch (DfIdentityException e) {
exceptionalStop(e);
} catch (DfAuthenticationException e) {
exceptionalStop(e);
} catch (DfPrincipalException e) {
exceptionalStop(e);
} catch (DfServiceException e) {
exceptionalStop(e);
}
return iDfSession;
}


public IDfSessionManager getIDfSessionManager() throws DDfException {
IDfLoginInfo loginInfo = new DfLoginInfo();
loginInfo.setUser(userName);
loginInfo.setPassword(password);
iDfSessionManager = getClient().newSessionManager();
try {
iDfSessionManager.setIdentity(repositoryName, loginInfo);
} catch (DfServiceException e) {
exceptionalStop(e);
}
return iDfSessionManager;
}

public IDfClient getClient() {
try {
client = DfClient.getLocalClient();
} catch (DfException e) {
cbean.setStop_var(true);
helper.setLogStr("Exception Getting IDfClient " + e.getMessage());
e.printStackTrace();
}
return client;
}

public void closeSession(){
if (iDfSessionManager != null && iDfSession != null && iDfSession.isConnected()) {
iDfSessionManager.release(iDfSession);
iDfSession = null;
iDfSessionManager = null;
}
}
public String getRepositoryName() {
return repositoryName;
}

public void setRepositoryName(String repositoryName) {
this.repositoryName = repositoryName;
}

public String getUserName() {
return userName;
}

public void setUserName(String userName) {
this.userName = userName;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public void setHelpers(UtilityHelper helper) {
this.helper = helper;
}



private static IDfSession iDfSession = null;
private static IDfSessionManager iDfSessionManager = null;
private static IDfClient client;
String repositoryName ;
String userName ;
String password ;
String domain;
private UtilityHelper helper;

}

No comments:

Post a Comment