package com.novell.admin.ndssnapins.loginMethods.CPassword;
import java.text.*;
import com.novell.admin.ns.*;
import com.novell.admin.ns.nds.*;
import com.novell.admin.common.snapins.*;
import com.novell.application.console.snapin.*;
import com.novell.utility.nmsgbox.*;
import com.novell.security.japi.nmas.*;
import com.novell.admin.security.util.*;
import com.novell.application.console.snapin.context.*;
public final class CPasswordSnapin extends AdminPageSnapin
{
private boolean debug = true;
private String tree;
private String userDN;
public boolean initSnapin(InitSnapinInfo snapinInfo)
{
String objectTypeString;
String coUserDN;
int slashLoc;
if(debug)
System.out.println("CPasswordSnapin.initSnapin()");
if (super.initSnapin(snapinInfo))
{
int ccode;
tabName = CPassword.getString(CPassword.CPassword_METHOD_TAB);
menuName = CPassword.getString(CPassword.CPassword_MENU_NAME);
snapin_name = CPassword.getString(CPassword.CPassword_SNAPIN_NAME);
snapin_description = CPassword.getString(CPassword.CPassword_METHOD_SNAPIN_DESCRIPTION);
if (OSUtil.getOStype() == OSUtil.NETWARE)
{
thePanel = new UnsupportedPanel(info, this, nsObj);
return true;
}
try
{
System.loadLibrary("NMASWrap");
}
catch(UnsatisfiedLinkError ex)
{
NMsgBox msg = new NMsgBox(shell.getShellFrame(),
CPassword.getString(CPassword.CPassword_LOAD_LIBRARY_FAILED_TITLE),
CPassword.getString(CPassword.CPassword_LOAD_LIBRARY_FAILED_MESSAGE),
3, null, null);
msg.show();
return false;
}
PageSnapinContext pageContext = (PageSnapinContext)snapinInfo.getSnapinContext();
ObjectEntryCollection oec = pageContext.getObjectCollection();
if (oec.hasNoElements())
{
if(debug)
System.out.println("oec.hasNoElements() == true");
return false;
}
coUserDN = oec.getFirstElement().getFullName();
slashLoc = coUserDN.indexOf('/');
tree = coUserDN.substring(0, slashLoc);
userDN = coUserDN.substring(slashLoc+1, coUserDN.length());
if (debug)
{
System.out.println("The tree we are working on is " + tree);
}
ObjectEntry oe = oec.getFirstElement();
objectTypeString = oe.getObjectType().getName();
if (debug)
{
System.out.println("The value of object type is " + objectTypeString);
}
if (!objectTypeString.equals("User"))
{
System.out.println("objectTypeString != User");
return false;
}
else
{
if (debug)
{
System.out.println("The selected object is a \"User\" object");
}
}
if(debug)
System.out.println("Creating CPasswordPanel...");
thePanel = new CPasswordPanel(info, this, nsObj, tree, userDN);
return true;
}
else
{
return false;
}
}
public void showHelp()
{
}
public boolean saveData()
{
return(((CPasswordPanel)thePanel).savePassword());
}
}