Hi,
I am having the java program to connect to Documentum, as given below. But the thing is I am executing the java program using lotus notes. ie. I am calling the java functions from lotusscript agent.
The problem is the session is not released properly after calling sessionmanager.release(session); function.
Anyone please help me on this.
Here is my code.
Java Code:
import lotus.domino.*;
import java.io.IOException;
import java.util.Date;
import com.documentum.com.DfClientX;
import com.documentum.com.IDfClientX;
import com.documentum.fc.client.DfQuery;
import com.documentum.fc.client.IDfClient;
import com.documentum.fc.client.IDfCollection;
import com.documentum.fc.client.IDfQuery;
import com.documentum.fc.client.IDfSession;
import com.documentum.fc.client.IDfSessionManager;
import com.documentum.fc.common.DfException;
import com.documentum.fc.common.DfLoginInfo;
import com.documentum.fc.common.IDfLoginInfo;
public class DQLCall extends AgentBase
{
public IDfSessionManager sessionManager = null;
public IDfSession session = null;
//Function used for session connectivity to the Documentum
public String sessionConnectivity(String DocBaseName, String UserName, String Password)
{
try
{
IDfClientX DfClientX = new DfClientX();
IDfClient client = DfClientX.getLocalClient();
if (sessionManager == null)
{
sessionManager = client.newSessionManager();
IDfLoginInfo loginInfo = new DfLoginInfo();
loginInfo.setUser(UserName);
loginInfo.setPassword(Password);
loginInfo.setDomain(“”);
sessionManager.setIdentity(DocBaseName, loginInfo);
}
session = sessionManager.getSession(DocBaseName);
return session.getDocbaseName();
}
catch (DfException dfException)
{
dfException.printStackTrace();
return “Error”;
}
catch( Exception ioe)
{
return “SessionFailed”;
}
} //End of sessionConnectivity function
//Function used to check that the particular file is existing in the documentum or not
public String checkDocumentExist(String Query)
{
StringBuffer buffer = new StringBuffer(512);
buffer.append(Query);
try
{
IDfCollection coll = null;
IDfQuery query = new DfQuery();
query.setDQL(buffer.toString());
coll = query.execute(session, DfQuery.DF_QUERY);
if(coll.next())
{
coll.close();
return “DocumentFound”;
}
else
{
coll.close();
return “DocumentNotFound”;
}
}
catch(Exception dfe)
{
dfe.printStackTrace();
return “Error:”+dfe.toString();
}
}
//End of checkDocumentExist function
//Function to release the current session
public void releaseCurrentSession()
{
try
{
if (sessionManager != null && session != null)
{
sessionManager.release(session);
//session = null;
//sessionManager = null;
}
}
catch(Exception ee)
{
ee.printStackTrace();
System.out.println(“Error in releasing the session.”);
}
finally
{
if (sessionManager != null && session != null)
{
sessionManager.release(session);
}
}
} //End of releaseCurrentSession function
} // End of DocumentStatus Class
Lotus Notes Agent:
Options Section:
Option Public
Use “DQLCall”
Uselsx “*javacon”
Initialize Section:
Sub Initialize
On Error Goto ErrHandler
Dim javaSession As JavaSession
Dim javaUtilClass As JAVACLASS
Dim javaUtil As Variant
Set javaSession = New JAVASESSION
Set javaUtilClass = javaSession.GetClass(“Test”)
Set javaUtil =javaUtilClass.CreateObject()
strResult = javaUtil.sessionConnectivity(“GenRe_ua01”,“fact_gcf_importer”,“password”)
Msgbox strResult
strResult = javaUtil.checkDocumentExist(“Select * from re_facultative_file_gcf where source = ‘FDS’ and original_document_dt=date(‘03/22/2010 18:03:06:280’) and object_name=‘Quote.PDF’ and submission_Id=3668309”)
Msgbox strResult
Call javaUtil.releaseCurrentSession()
strResult = javaUtil.checkDocumentExist(“Select * from re_facultative_file_gcf where source = ‘FDS’ and original_document_dt=date(‘03/22/2010 18:03:06:280’) and object_name=‘Quote.PDF’ and submission_Id=3668309”)
Msgbox strResult
Exit Sub
ErrHandler:
Msgbox “Error : " + Error$ + " at line no. " + Cstr(Erl) + " in Test Agent.”
Exit Sub
End Sub
Regards,
Tamilselvi K S