hi to all..
i am new on documentum server..i have to connect my application(written in java) to remote documentum server,i want to know what type of software required on my local machine. is dfc installation is required on local machine.which version is required..where cn i get dfc for installation if required.where i hav to put dfc.proerties what should be chane in code for connection.code and dfc.properties given below..please help me....
// Creating session with Documentum
public IDFSession getSession(String docbaseName, String username, String password)
throws Exception
{
IDFSession session;
IDfLoginInfo loginInfo = new DfLoginInfo();
loginInfo.setUser(username);
loginInfo.setPassword(password);
IDfClient client = DfClient.getLocalClient();
IDfSessionManager sessMgr = client.newSessionManager();
sessMgr.setIdentity(docbaseName, loginInfo);
return sessMgr.getSession(docbaseName);
}
// #1 ----------------------- Search on Attributes -----------------------
folder = (IDfFolder) session.getFolderByPath(FOLDER_PATH);
collection = null;
// Search by Author
String dql = "SELECT r_object_id from dm_document WHERE ANY authors = '" + authorName + "'";
IDfQuery query = new DfQuery();
query.setDQL(dql);
try
{
collection = query.execute(session, IDfQuery.DF_READ_QUERY);
while (collection.next())
{
document = (IDfDocument) session.getObject(collection.getId("r_object_id"));
// Do something with document
}
}
finally
{
// Cleanup collections
if (collection != null)
{
collection.close();
}
}
// #1 ----------------------- Search on Document Content -----------------------
collection = null;
String dql = "SELECT r_object_id from dm_document SEARCH DOCUMENT CONTAINS '%" + searchString + "%'";
IDfQuery query = new DfQuery();
query.setDQL(dql);
try
{
collection = query.execute(session, IDfQuery.DF_READ_QUERY);
while (collection.next())
{
document = (IDfDocument) session.getObject(collection.getId("r_object_id"));
// Do something with document
}
}
finally
{
// Cleanup collections
if (collection != null)
{
collection.close();
}
}
// #2 ----------------------- New Document -----------------------
public IDfDocument createDocument()
throws Exception
{
// Create cabinet - if required
createCabinet();
// Create folder - if required
createFolder();
IDfDocument documentObj = (IDfDocument) session.newObject("dm_document");
if (documentObj != null)
{
documentObj.setObjectName("Document_1_test");
documentObj.setContentType("crtext");
documentObj.setFile("C:\\DFC_TEST\\DFC_TEST.txt");
documentObj.link("/Cabinet_root_test/Folder_1_test");
documentObj.save();
}
return documentObj;
}
public void createCabinet()
throws Exception
{
IDfFolder cabinetObj = (IDfFolder) session.newObject("dm_cabinet");
if (cabinetObj != null)
{
cabinetObj.setObjectName("Cabinet_root_test");
cabinetObj.save();
}
}
public void createFolder()
throws Exception
{
IDfFolder folderObj = (IDfFolder) session.newObject("dm_folder");
if (folderObj != null)
{
folderObj.setObjectName("Folder_1_test");
folderObj.link("/Cabinet_root_test");
folderObj.save();
}
}
// #3 ----------------------- Remove Document -----------------------
// Obtain the dfDocument for the current Object Id.
IDfDocument dfDocument = (IDfDocument) session.getObjectByQualification("dm_document where r_object_id = '" + objectId + "'"));
if (dfDocument != null)
{
// To destroy the current version.
dfDocument.destroy();
// To destroy All the versions.
dfDocument.destroyAllVersions();
}
// #4 ----------------------- Download Document -----------------------
IDfDocument dfDocument = (IDfDocument) session.getObjectByQualification("dm_document where r_object_id = '" + objectId + "'"));
ByteArrayInputStream bis;
if (dfDocument != null)
{
bis = dfDocument.getContent();
}
int bytesRead;
byte[] buffer = new byte[4096];
OutputStream os = new FileOutputStream("C:\\Test.txt");
while ((bytesRead = bis.read(buffer)) != -1)
{
os.write(buffer, 0, bytesRead);
}
os.close();
and dfc.properties written below.........
dfc.docbroker.host[0]=repoHostName
dfc.globalregistry.repository=repoName
dfc.globalregistry.username=repoUserName
dfc.globalregistry.password=repoUserPassword
dfc.docbroker.port[0]=1489
dfc.data.dir=/tmp/documentum