// bind.java - Edited simple demonstration of binding
// a DS object using AFC ADSI.
// Any comment beginning "// ..." means java codes lines have
// been deleted for simpler logic flow. For complete code,
// see ADSI samples.
//
// Copyright © 1997 Microsoft Corporation
// All Rights Reserved
//
// ... import statements
class bind
{
private ADsConn m_conn = null;
private IADs m_adsobj = null;
private IADsOpenDSObject m_namespace = null;
String iniFileName = ".\\jadsi.ms";
// ... Initializations
public static void main(String args[])
{
bind bindObject = null;
// ... Check the arguments on input
if (bindObject != null) {
bindObject.bindToObject();
}
}
public bind()
{ // ... Prompt for ADsPath, UserName, Passwd }
public bind(String args[])
{ // ... Get ADsPath, UserName, PassWd from the args array }
public void bindToObject()
{
try { // Process the .ini file to set up AFC ADSI
m_conn = new ADsConn(iniFileName);
} // ... plus error handling
try { // instantiate the LDAP namespace object
m_namespace = (IADsOpenDSObject)m_conn.getObject("LDAP:");
// Fetch a DS object using the specified parameters.
m_adsobj = (IADs)m_namespace.OpenDSObject(ADsPath, UserName,
PassWd, 0);
// ... print out IADs object properties
} // ... plus error handling
// ... Exit code
}
}