|
This Java code sample demonstrates how to programmatically set the Docbroker during login
using the getClientConfig method.
The getClientConfig method lets you get and set information relating to your client configuration object, it maps
directly to the API Config object. Through the client configuration object you can dynamically
configure your Docbroker, the maximum number of simultaneous
sessions allowed, and the maximum number of open collections allowed. (Note: You
should alter the default values only after reading the server administration
documentation.)
Refer to the Server Administrator's Guide for more information about client
configuration.
import com.documentum.fc.client.*;
import com.documentum.fc.common.*;
import com.documentum.fc.client.*;
import com.documentum.fc.common.*;
public class Connect
{
public static void main (String args[])
{
if (args.length != 4)
{
System.out.println ("usage: java Connect docbroker docbase username password");
return;
}
String docbroker = args[0];
String docbase = args[1];
String username = args[2];
String password = args[3];
try
{
IDfClient client = DfClient.getLocalClient();
// Once we get the config object, we can set the kinds of things
// that are usually specified in the dmcl.ini
IDfTypedObject config = client.getClientConfig();
config.setString ("primary_host", docbroker);
IDfLoginInfo li = new DfLoginInfo();
li.setUser(username);
li.setPassword(password);
IDfSession docbase_session = client.newSession(docbase, li);
if (docbase_session != null)
{
System.out.println ("Got a session");
}
else
{
System.out.println ("Didn't get a session");
return;
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
|