0001: package migration.modules.ldap;
0002:
0003: import netscape.ldap.util.*;
0004:
0005: import netscape.ldap.LDAPAttribute;
0006: import netscape.ldap.LDAPAttributeSet;
0007:
0008: import java.util.*;
0009: import java.io.*;
0010:
0011: public class DomainAttrs extends CommonXml {
0012:
0013: static OutputStreamWriter outFile;
0014: static String roleMigrationType;
0015: static String ldapUserPasswd;
0016:
0017: /* Netmail pertaining constants: */
0018: static final int NETMAIL_USER_SMTP_SERVER = 90;
0019: static final int NETMAIL_USER_IMAP_SERVER = 91;
0020: static final int NETMAIL_USER_DEFAULTMAILDOMAIN = 92;
0021: static final int NETMAIL_ROOT_FOLDER = 93;
0022: static final int NETMAIL_SENT_FOLDER = 94;
0023: static final int NETMAIL_REPLY_WITHAUTHOR = 95;
0024: static final int NETMAIL_REPLY_WITHBODY = 96;
0025: static final int NETMAIL_REPLY_WITHDATE = 97;
0026: static final int NETMAIL_INDENT_PREFIX = 98;
0027: static final int NETMAIL_ADD_SIGNATURE = 99;
0028: static final int NETMAIL_INITIAL_HDRS = 100;
0029: static final int NETMAIL_INACTIVITY_INTERVAL = 101;
0030: static final int NETMAIL_MAX_ATTACH_LEN = 102;
0031: static final int NETMAIL_AUTOLOAD = 103;
0032: static final int NETMAIL_AUTOSAVE = 104;
0033: static final int NETMAIL_AUTOPURGE = 105;
0034: static final int NETMAIL_AUTOFOLDERLOAD = 106;
0035: static final int NETMAIL_MULTIPLE_RDW = 107;//Multiple Read Windows
0036: static final int NETMAIL_HEADERS_PAGE = 108;
0037: static final int NETMAIL_NEWEST_FIRST = 109;
0038: static final int NETMAIL_LOGMSSGS = 110;
0039: static final int NETMAIL_NOPREFSLIST = 111;
0040: static final int NETMAIL_LDAPSERVERS = 112;
0041:
0042: static HashMap ATTRIBUTES = new HashMap();
0043:
0044: public static void main(String args[]) {
0045:
0046: String outputDir, ldifDir;
0047:
0048: ldifDir = new String();// Input file, the LDIF file to be converted....
0049: outputDir = new String();
0050:
0051: getNamingAttributes(System.getProperty("IMPORT_DIR"));
0052: getAMConfigProperties();
0053:
0054: InitHashMap();
0055: if (args.length == 2) {
0056: outputDir = args[1];
0057: ldifDir = args[0];
0058: } else if (args.length == 1) {
0059: outputDir = new String("/tmp/xml");
0060: ldifDir = args[0];
0061: } else if (args.length == 0) {
0062: System.out
0063: .println("Input file to be converted not specified!");
0064: System.out
0065: .println("Invokation Format is:java DomainAttrs ldif_directory output_dir");
0066: System.exit(1);
0067: }
0068:
0069: roleMigrationType = new String("org");
0070:
0071: if (System.getProperty("ROLE_TYPE") != null) {
0072: roleMigrationType = System.getProperty("ROLE_TYPE");
0073: }
0074: if (System.getProperty("LDAPUSER_PASSWD") != null) {
0075: ldapUserPasswd = System.getProperty("LDAPUSER_PASSWD");
0076: }
0077:
0078: try {
0079: outOrgsList_LDAP = new OutputStreamWriter(
0080: new FileOutputStream(outputDir + "/.orgslist"),
0081: "UTF-8");
0082: doConvert(ldifDir + "/application.ldif", outputDir
0083: + "/desktopDefaultType.xml");
0084: doConvert(ldifDir + "/domain.ldif", outputDir
0085: + "/desktopOrgAttrs.xml");
0086: doConvert(ldifDir + "/role.ldif", outputDir
0087: + "/desktopRoleAttrs.xml");
0088: setGlobalServiceAttr(outputDir
0089: + "/desktopGlobalServiceAttrs.xml");
0090: outOrgsList_LDAP.close();
0091: } catch (Exception e) {
0092: System.out.println("Error:" + e.toString());
0093: e.printStackTrace();
0094: }
0095: }
0096:
0097: public static void doConvert(String ldiffile, String outputfile) {
0098: LDIFRecord out;
0099: int count = 0;
0100: LDIF l1;
0101:
0102: try {
0103: l1 = new LDIF(ldiffile);
0104: outFile = new OutputStreamWriter(new FileOutputStream(
0105: outputfile), "UTF-8");
0106:
0107: //System.out.println("Converting LDIF entries corr. to users from file:"+ldiffile+".....\n");
0108:
0109: LDIFRecord tmp = l1.nextRecord();
0110:
0111: printHeader();
0112: while (tmp != null) {
0113: ProcessRecord(tmp);
0114: tmp = l1.nextRecord();
0115: }
0116: outFile.write("\n</Requests>");
0117: outFile.close();
0118: //System.out.println("Processed "+count+" entries");
0119: //System.out.println("Output available in file "+outputfile);
0120: } catch (Exception e) {
0121: System.out.println("Error:" + e.toString());
0122: e.printStackTrace();
0123: }
0124: }
0125:
0126: static void printHeader() throws Exception {
0127:
0128: outFile
0129: .write("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
0130: outFile
0131: .write("\n<!-- PROPRIETARY/CONFIDENTIAL/ Use of this product is subject");
0132: outFile
0133: .write("\n to license terms. Copyright 2001 Sun Microsystems Inc.");
0134: outFile
0135: .write("Some preexisting portions Copyright 2001 Netscape");
0136: outFile.write("Communications Corp. All rights reserved. -->");
0137: outFile
0138: .write("\n<!DOCTYPE Requests PUBLIC \"-//Sun ONE//iDSAME 5.0 Admin CLI DTD//EN \" ");
0139: outFile
0140: .write("\"file:" + IDSAMEBaseDir
0141: + "/dtd/amAdmin.dtd\">");
0142:
0143: outFile.write("\n<Requests>");
0144: return;
0145: }
0146:
0147: static void ProcessRecord(LDIFRecord toConvert) throws Exception {
0148: LDIFAttributeContent con;
0149: LDAPAttributeSet theAttrSet;
0150: String[] allAttrs;
0151: String attrName;
0152: String profileid, org, profiletype, rolename, parent;
0153: boolean tabContainerFound = false;
0154: boolean authModulesToAdd = false;
0155: boolean deriveAuthFromApp = true;
0156: String dn = new String();
0157: profileid = new String();
0158:
0159: LDAPAttribute[] attrList;
0160:
0161: profiletype = parent = rolename = null;
0162: org = getOrgName(toConvert.getDN());
0163:
0164: con = (LDIFAttributeContent) toConvert.getContent();
0165: attrList = con.getAttributes();
0166: theAttrSet = new LDAPAttributeSet(attrList);
0167: for (int i = 0; i < attrList.length; ++i) {
0168: if ((attrList[i].getName()).equalsIgnoreCase("profiletype")) {
0169: allAttrs = (((LDAPAttribute) (theAttrSet
0170: .getAttribute(attrList[i].getName())))
0171: .getStringValueArray());
0172: profiletype = allAttrs[0];
0173: }
0174: if ((attrList[i].getName()).equalsIgnoreCase("profileid")) {
0175: allAttrs = (((LDAPAttribute) (theAttrSet
0176: .getAttribute(attrList[i].getName())))
0177: .getStringValueArray());
0178: profileid = allAttrs[0];
0179: }
0180: if ((attrList[i].getName()).equalsIgnoreCase("cn")) {
0181: allAttrs = (((LDAPAttribute) (theAttrSet
0182: .getAttribute(attrList[i].getName())))
0183: .getStringValueArray());
0184: rolename = allAttrs[0];
0185: }
0186: if ((attrList[i].getName()).equalsIgnoreCase("parent")) {
0187: allAttrs = (((LDAPAttribute) (theAttrSet
0188: .getAttribute(attrList[i].getName())))
0189: .getStringValueArray());
0190: parent = allAttrs[0];
0191: }
0192: }
0193:
0194: if (profiletype.equalsIgnoreCase("role"))
0195: dn = ConstructDN(profileid);
0196:
0197: if (!profiletype.equalsIgnoreCase("application")) {
0198:
0199: for (int i = 0; i < attrList.length; ++i) {
0200: attrName = attrList[i].getName();
0201: allAttrs = (((LDAPAttribute) (theAttrSet
0202: .getAttribute(attrList[i].getName())))
0203: .getStringValueArray());
0204: if (allAttrs == null || allAttrs.length <= 1)
0205: break;
0206:
0207: if (attrType(attrName) >= NETMAIL_USER_SMTP_SERVER
0208: && attrType(attrName) <= NETMAIL_LDAPSERVERS) {
0209: if (profiletype.equalsIgnoreCase("domain"))
0210: outFile.write("\n <OrganizationRequests DN=\""
0211: + constructOrgDN(org, rootsuffix)
0212: + "\">");
0213: if (profiletype.equalsIgnoreCase("role")) {
0214: if (!roleMigrationType.equalsIgnoreCase("flat"))
0215: outFile
0216: .write("\n <OrganizationRequests DN=\""
0217: + dn.substring(1)
0218: + ","
0219: + rootsuffix + "\">");
0220: else
0221: outFile
0222: .write("\n <RoleRequests DN=\""
0223: + getMangledRoleWithOrgFromProfileId(profileid)
0224: + "," + rootsuffix + "\">");
0225: }
0226: outFile
0227: .write("\n <ModifyServiceTemplate serviceName=\"SunPortalNetMailService\" schemaType=\"Dynamic\">");
0228: outFile.write("\n <AttributeValuePair>");
0229: outFile.write(setNetMailServiceAttributes(attrName,
0230: allAttrs));
0231: outFile.write("\n </AttributeValuePair>");
0232: outFile.write("\n </ModifyServiceTemplate>");
0233: if ((profiletype.equalsIgnoreCase("domain"))
0234: || ((profiletype.equalsIgnoreCase("role")) && (!roleMigrationType
0235: .equalsIgnoreCase("flat"))))
0236: outFile.write("\n </OrganizationRequests>");
0237: else
0238: outFile.write("\n </RoleRequests>");
0239: }
0240: if (attrName.equalsIgnoreCase("iwtAuthLdap-server-at")) {
0241: if (allAttrs[1].indexOf(":") != -1)
0242: allAttrs[1] = allAttrs[1].substring(0,
0243: allAttrs[1].indexOf(":"));
0244: if (allAttrs[1].equalsIgnoreCase(hostname)) {
0245: outOrgsList_LDAP.write("\n" + org);
0246: }
0247: }
0248:
0249: if (attrName.equalsIgnoreCase("iwtPlatform-locale-at")
0250: && profiletype.equalsIgnoreCase("domain")) {
0251: outFile.write("\n<OrganizationRequests DN=\""
0252: + constructOrgDN(org, rootsuffix) + "\">");
0253: outFile
0254: .write("\n <ModifyServiceTemplate serviceName=\"iPlanetAMAuthService\" schemaType=\"Organization\">");
0255: outFile.write("\n <AttributeValuePair>");
0256: outFile
0257: .write("\n <Attribute name=\"iplanet-am-auth-locale\"/>");
0258: outFile.write("\n <Value>" + allAttrs[1]);
0259: outFile.write("</Value>");
0260: outFile.write("\n </AttributeValuePair>");
0261: outFile.write("\n </ModifyServiceTemplate>");
0262: outFile.write("\n</OrganizationRequests>");
0263: }
0264:
0265: if (attrName
0266: .equalsIgnoreCase("iwtDesktop-userSelectedProviders-at")) {
0267: if (profiletype.equalsIgnoreCase("domain"))
0268: outFile.write("\n <OrganizationRequests DN=\""
0269: + constructOrgDN(org, rootsuffix)
0270: + "\">");
0271: if (profiletype.equalsIgnoreCase("role")) {
0272: if (!roleMigrationType.equalsIgnoreCase("flat"))
0273: outFile
0274: .write("\n <OrganizationRequests DN=\""
0275: + dn.substring(1)
0276: + ","
0277: + rootsuffix + "\">");
0278: else
0279: outFile
0280: .write("\n <RoleRequests DN=\""
0281: + getMangledRoleWithOrgFromProfileId(profileid)
0282: + "," + rootsuffix + "\">");
0283: }
0284: outFile
0285: .write("\n <ModifyServiceTemplate serviceName=\"SunPortalDesktopService\" schemaType=\"Dynamic\">");
0286: if (allAttrs.length > 1) {
0287: for (int jk = 1; jk < allAttrs.length; ++jk) {
0288: if (allAttrs[jk]
0289: .equalsIgnoreCase("iwtTabProvider")) {
0290: tabContainerFound = true;
0291: //System.out.println("Found...");
0292: }
0293: }
0294: }
0295:
0296: outFile.write("\n <AttributeValuePair>");
0297: outFile
0298: .write("\n <Attribute name=\"sunPortalDesktopDefaultChannelName\"/>");
0299: outFile.write("\n <Value>");
0300: if (tabContainerFound == true)
0301: outFile.write("TemplateTabContainer");
0302: else
0303: outFile.write("TemplateTableContainer");
0304: outFile.write("</Value>");
0305: outFile.write("\n </AttributeValuePair>");
0306: outFile.write("\n </ModifyServiceTemplate>");
0307: if ((profiletype.equalsIgnoreCase("domain"))
0308: || ((profiletype.equalsIgnoreCase("role")) && (!roleMigrationType
0309: .equalsIgnoreCase("flat"))))
0310: outFile.write("\n </OrganizationRequests>");
0311: else
0312: outFile.write("\n </RoleRequests>");
0313: }
0314: if (attrName.equalsIgnoreCase("iwtUser-timezone-at")) {
0315: if (profiletype.equalsIgnoreCase("domain"))
0316: outFile.write("\n <OrganizationRequests DN=\""
0317: + constructOrgDN(org, rootsuffix)
0318: + "\">");
0319: if (profiletype.equalsIgnoreCase("role")) {
0320: if (!roleMigrationType.equalsIgnoreCase("flat"))
0321: outFile
0322: .write("\n <OrganizationRequests DN=\""
0323: + dn.substring(1)
0324: + ","
0325: + rootsuffix + "\">");
0326: else
0327: outFile
0328: .write("\n <RoleRequests DN=\""
0329: + getMangledRoleWithOrgFromProfileId(profileid)
0330: + "," + rootsuffix + "\">");
0331:
0332: }
0333: outFile
0334: .write("\n <ModifyServiceTemplate serviceName=\"iPlanetAMUserService\" schemaType=\"Dynamic\">");
0335: outFile.write("\n <AttributeValuePair>");
0336: outFile
0337: .write("\n <Attribute name=\"preferredtimezone\"/>");
0338: outFile.write("\n <Value>" + allAttrs[1]);
0339: outFile.write("</Value>");
0340: outFile.write("\n </AttributeValuePair>");
0341: outFile.write("\n </ModifyServiceTemplate>");
0342: if ((profiletype.equalsIgnoreCase("domain"))
0343: || ((profiletype.equalsIgnoreCase("role")) && (!roleMigrationType
0344: .equalsIgnoreCase("flat"))))
0345: outFile.write("\n </OrganizationRequests>");
0346: else
0347: outFile.write("\n </RoleRequests>");
0348: }
0349: if (attrName.equalsIgnoreCase("iwtUser-authModules-at")) {
0350: if (profiletype.equalsIgnoreCase("domain"))
0351: outFile.write("\n <OrganizationRequests DN=\""
0352: + constructOrgDN(org, rootsuffix)
0353: + "\">");
0354: if (profiletype.equalsIgnoreCase("role")) {
0355: if (!roleMigrationType.equalsIgnoreCase("flat"))
0356: outFile
0357: .write("\n <OrganizationRequests DN=\""
0358: + dn.substring(1)
0359: + ","
0360: + rootsuffix + "\">");
0361: else
0362: outFile
0363: .write("\n <RoleRequests DN=\""
0364: + getMangledRoleWithOrgFromProfileId(profileid)
0365: + "," + rootsuffix + "\">");
0366:
0367: }
0368: outFile
0369: .write("\n <ModifyServiceTemplate serviceName=\"iPlanetAMUserService\" schemaType=\"Dynamic\">");
0370: outFile.write("\n <AttributeValuePair>");
0371: outFile
0372: .write("\n <Attribute name=\"iplanet-am-user-auth-modules\"/>");
0373: for (int jk = 1; jk < allAttrs.length; ++jk) {
0374: outFile.write("\n <Value>"
0375: + allAttrs[jk]);
0376: outFile.write("</Value>");
0377: }
0378: outFile.write("\n </AttributeValuePair>");
0379: outFile.write("\n </ModifyServiceTemplate>");
0380: if ((profiletype.equalsIgnoreCase("domain"))
0381: || ((profiletype.equalsIgnoreCase("role")) && (!roleMigrationType
0382: .equalsIgnoreCase("flat"))))
0383: outFile.write("\n </OrganizationRequests>");
0384: else
0385: outFile.write("\n </RoleRequests>");
0386: }
0387: if (attrName.equalsIgnoreCase("iwtDesktop-type-at")) {
0388: if (profiletype.equalsIgnoreCase("domain"))
0389: outFile.write("\n <OrganizationRequests DN=\""
0390: + constructOrgDN(org, rootsuffix)
0391: + "\">");
0392: if (profiletype.equalsIgnoreCase("role")) {
0393: if (!roleMigrationType.equalsIgnoreCase("flat"))
0394: outFile
0395: .write("\n <OrganizationRequests DN=\""
0396: + dn.substring(1)
0397: + ","
0398: + rootsuffix + "\">");
0399: else
0400: outFile
0401: .write("\n <RoleRequests DN=\""
0402: + getMangledRoleWithOrgFromProfileId(profileid)
0403: + "," + rootsuffix + "\">");
0404:
0405: }
0406: outFile
0407: .write("\n <ModifyServiceTemplate serviceName=\"SunPortalDesktopService\" schemaType=\"Dynamic\">");
0408: outFile.write("\n <AttributeValuePair>");
0409: outFile
0410: .write("\n <Attribute name=\"sunPortalDesktopType\"/>");
0411: outFile.write("\n <Value>" + allAttrs[1]);
0412: outFile.write("</Value>");
0413: outFile.write("\n </AttributeValuePair>");
0414: outFile.write("\n </ModifyServiceTemplate>");
0415: if ((profiletype.equalsIgnoreCase("domain"))
0416: || ((profiletype.equalsIgnoreCase("role")) && (!roleMigrationType
0417: .equalsIgnoreCase("flat"))))
0418: outFile.write("\n </OrganizationRequests>");
0419: else
0420: outFile.write("\n </RoleRequests>");
0421: }
0422:
0423: int authModulesReg;
0424: if (attrName.equalsIgnoreCase("iwtAuth-authMenu-at")) {
0425: deriveAuthFromApp = false;
0426: authModulesReg = allAttrs.length - 1;
0427: for (int ik = 1; ik < allAttrs.length; ++ik) {
0428: //if(allAttrs[ik].equalsIgnoreCase("LDAP") || allAttrs[ik].equalsIgnoreCase("Membership") || allAttrs[ik].equalsIgnoreCase("Anonymous")) authModulesReg--;
0429: if (allAttrs[ik].equalsIgnoreCase("LDAP")
0430: || allAttrs[ik]
0431: .equalsIgnoreCase("SKey")
0432: || allAttrs[ik]
0433: .equalsIgnoreCase("SecurID")
0434: || allAttrs[ik]
0435: .equalsIgnoreCase("Radius"))
0436: authModulesReg--;
0437:
0438: }
0439: if (profiletype.equalsIgnoreCase("role"))
0440: org = dn.substring(3);//Ignoring the initial o=,
0441: if ((profiletype.equalsIgnoreCase("role") || profiletype
0442: .equalsIgnoreCase("domain"))
0443: && authModulesReg > 0) {
0444:
0445: for (int ik = 1; ik < allAttrs.length; ++ik) {
0446: if (allAttrs[ik]
0447: .equalsIgnoreCase("Anonymous")) {
0448: outFile
0449: .write("\n <OrganizationRequests DN=\""
0450: + constructOrgDN(org,
0451: rootsuffix)
0452: + "\">");
0453: outFile
0454: .write("\n <RegisterServices>");
0455: outFile
0456: .write("\n <Service_Name>iPlanetAMAuthAnonymousService</Service_Name>");
0457: outFile
0458: .write("\n </RegisterServices>");
0459: outFile
0460: .write("\n </OrganizationRequests>");
0461: }
0462: if (allAttrs[ik]
0463: .equalsIgnoreCase("Membership")) {
0464: outFile
0465: .write("\n <OrganizationRequests DN=\""
0466: + constructOrgDN(org,
0467: rootsuffix)
0468: + "\">");
0469: outFile
0470: .write("\n <RegisterServices>");
0471: outFile
0472: .write("\n <Service_Name>iPlanetAMAuthMembershipService</Service_Name>");
0473: outFile
0474: .write("\n </RegisterServices>");
0475: outFile
0476: .write("\n </OrganizationRequests>");
0477: }
0478: if (allAttrs[ik]
0479: .equalsIgnoreCase("Safeword")) {
0480: outFile
0481: .write("\n <OrganizationRequests DN=\""
0482: + constructOrgDN(org,
0483: rootsuffix)
0484: + "\">");
0485: outFile
0486: .write("\n <RegisterServices>");
0487: outFile
0488: .write("\n <Service_Name>iPlanetAMAuthSafeWordService</Service_Name>");
0489: outFile
0490: .write("\n </RegisterServices>");
0491: outFile
0492: .write("\n </OrganizationRequests>");
0493: }
0494: if (allAttrs[ik].equalsIgnoreCase("Unix")) {
0495: outFile
0496: .write("\n <OrganizationRequests DN=\""
0497: + constructOrgDN(org,
0498: rootsuffix)
0499: + "\">");
0500: outFile
0501: .write("\n <RegisterServices>");
0502: outFile
0503: .write("\n <Service_Name>iPlanetAMAuthUnixService</Service_Name>");
0504: outFile
0505: .write("\n </RegisterServices>");
0506: outFile
0507: .write("\n </OrganizationRequests>");
0508: }
0509: if (allAttrs[ik].equalsIgnoreCase("Cert")) {
0510: outFile
0511: .write("\n <OrganizationRequests DN=\""
0512: + constructOrgDN(org,
0513: rootsuffix)
0514: + "\">");
0515: outFile
0516: .write("\n <RegisterServices>");
0517: outFile
0518: .write("\n <Service_Name>iPlanetAMAuthCertService</Service_Name>");
0519: outFile
0520: .write("\n </RegisterServices>");
0521: outFile
0522: .write("\n </OrganizationRequests>");
0523: }
0524: }
0525:
0526: Vector valuesAuth = new Vector();
0527: for (int ik = 1; ik < allAttrs.length; ++ik) {
0528: if (allAttrs[ik].equalsIgnoreCase("LDAP")) {
0529: valuesAuth.add(new String("LDAP"));
0530: }
0531: if (allAttrs[ik].equalsIgnoreCase("Radius")) {
0532: valuesAuth.add(new String("Radius"));
0533: }
0534: if (allAttrs[ik]
0535: .equalsIgnoreCase("Anonymous")) {
0536: outFile
0537: .write("\n <OrganizationRequests DN=\""
0538: + constructOrgDN(org,
0539: rootsuffix)
0540: + "\">");
0541: outFile
0542: .write("\n <CreateServiceTemplate>");
0543: outFile
0544: .write("\n <Service_Name>iPlanetAMAuthAnonymousService</Service_Name>");
0545: outFile
0546: .write("\n </CreateServiceTemplate>");
0547: outFile
0548: .write("\n </OrganizationRequests>");
0549: valuesAuth.add(new String("Anonymous"));
0550: }
0551: if (allAttrs[ik]
0552: .equalsIgnoreCase("Membership")) {
0553: outFile
0554: .write("\n <OrganizationRequests DN=\""
0555: + constructOrgDN(org,
0556: rootsuffix)
0557: + "\">");
0558: outFile
0559: .write("\n <CreateServiceTemplate>");
0560: outFile
0561: .write("\n <Service_Name>iPlanetAMAuthMembershipService</Service_Name>");
0562: outFile
0563: .write("\n </CreateServiceTemplate>");
0564: outFile
0565: .write("\n </OrganizationRequests>");
0566:
0567: outFile
0568: .write("\n<OrganizationRequests DN=\""
0569: + constructOrgDN(org,
0570: rootsuffix)
0571: + "\">");
0572: outFile
0573: .write("\n <ModifyServiceTemplate serviceName=\"iPlanetAMAuthMembershipService\" schemaType=\"Organization\">");
0574: outFile
0575: .write("\n <AttributeValuePair>");
0576: outFile
0577: .write("\n <Attribute name=\"iplanet-am-auth-membership-base-dn\"/>");
0578: outFile
0579: .write("\n <Value>"
0580: + constructOrgDN(org,
0581: rootsuffix)
0582: + "</Value>");
0583: outFile
0584: .write("\n </AttributeValuePair>");
0585:
0586: outFile
0587: .write("\n <AttributeValuePair>");
0588: outFile
0589: .write("\n <Attribute name=\"iplanet-am-auth-membership-bind-passwd\"/>");
0590: outFile.write("\n <Value>"
0591: + ldapUserPasswd + "</Value>");
0592: outFile
0593: .write("\n </AttributeValuePair>");
0594: outFile
0595: .write("\n </ModifyServiceTemplate>");
0596: outFile
0597: .write("\n </OrganizationRequests>");
0598: valuesAuth
0599: .add(new String("Membership"));
0600: }
0601: if (allAttrs[ik]
0602: .equalsIgnoreCase("Safeword")) {
0603: outFile
0604: .write("\n <OrganizationRequests DN=\""
0605: + constructOrgDN(org,
0606: rootsuffix)
0607: + "\">");
0608: outFile
0609: .write("\n <CreateServiceTemplate>");
0610: outFile
0611: .write("\n <Service_Name>iPlanetAMAuthSafeWordService</Service_Name>");
0612: outFile
0613: .write("\n </CreateServiceTemplate>");
0614: //outFile.write(getCreateServiceTemplate("iPlanetAMAuthRadiusService"));
0615: outFile
0616: .write("\n </OrganizationRequests>");
0617: valuesAuth.add(new String("SafeWord"));
0618: }
0619: if (allAttrs[ik].equalsIgnoreCase("Unix")) {
0620: outFile
0621: .write("\n <OrganizationRequests DN=\""
0622: + constructOrgDN(org,
0623: rootsuffix)
0624: + "\">");
0625: outFile
0626: .write("\n <CreateServiceTemplate>");
0627: outFile
0628: .write("\n <Service_Name>iPlanetAMAuthUnixService</Service_Name>");
0629: outFile
0630: .write("\n </CreateServiceTemplate>");
0631: //outFile.write(getCreateServiceTemplate("iPlanetAMAuthUnixService"));
0632: outFile
0633: .write("\n </OrganizationRequests>");
0634: valuesAuth.add(new String("Unix"));
0635: }
0636: if (allAttrs[ik].equalsIgnoreCase("Cert")) {
0637: outFile
0638: .write("\n <OrganizationRequests DN=\""
0639: + constructOrgDN(org,
0640: rootsuffix)
0641: + "\">");
0642: outFile
0643: .write("\n <CreateServiceTemplate>");
0644: outFile
0645: .write("\n <Service_Name>iPlanetAMAuthCertService</Service_Name>");
0646: outFile
0647: .write("\n </CreateServiceTemplate>");
0648: //outFile.write(getCreateServiceTemplate("iPlanetAMAuthCertService"));
0649: outFile
0650: .write("\n </OrganizationRequests>");
0651: valuesAuth.add(new String("Cert"));
0652: }
0653: }
0654: outFile.write("\n <OrganizationRequests DN=\""
0655: + constructOrgDN(org, rootsuffix)
0656: + "\">");
0657: outFile
0658: .write("\n <ModifyServiceTemplate serviceName=\"iPlanetAMAuthService\" schemaType=\"Organization\">");
0659: outFile
0660: .write("\n <AttributeValuePair>");
0661: outFile
0662: .write("\n <Attribute name=\"iplanet-am-auth-allowed-modules\"/>");
0663: for (int jk = 0; jk < valuesAuth.size(); ++jk)
0664: outFile.write("\n <Value>"
0665: + (String) (valuesAuth
0666: .elementAt(jk))
0667: + "</Value>");
0668: outFile
0669: .write("\n </AttributeValuePair>");
0670: outFile
0671: .write("\n </ModifyServiceTemplate>");
0672: outFile.write("\n </OrganizationRequests>");
0673: }
0674: }
0675: }
0676: } else {
0677: for (int i = 0; i < attrList.length; ++i) {
0678: attrName = attrList[i].getName();
0679: allAttrs = (((LDAPAttribute) (theAttrSet
0680: .getAttribute(attrList[i].getName())))
0681: .getStringValueArray());
0682: if (attrName.equalsIgnoreCase("iwtUser-timezone-at")) {
0683: outFile
0684: .write("\n <SchemaRequests serviceName=\"iPlanetAMUserService\" SchemaType=\"Dynamic\">");
0685: outFile.write("\n <ModifyDefaultValues>");
0686: outFile.write("\n <AttributeValuePair>");
0687: outFile
0688: .write("\n <Attribute name=\"preferredtimezone\"/>");
0689: outFile.write("\n <Value>" + allAttrs[1]);
0690: outFile.write("</Value>");
0691: outFile.write("\n </AttributeValuePair>");
0692: outFile.write("\n </ModifyDefaultValues>");
0693: outFile.write("\n </SchemaRequests>");
0694: }
0695: if (attrName.equalsIgnoreCase("iwtDesktop-type-at")) {
0696: outFile
0697: .write("\n <SchemaRequests serviceName=\"SunPortalDesktopService\" SchemaType=\"Dynamic\">");
0698: outFile.write("\n <ModifyDefaultValues>");
0699: outFile.write("\n <AttributeValuePair>");
0700: outFile
0701: .write("\n <Attribute name=\"sunPortalDesktopType\"/>");
0702: outFile.write("\n <Value>" + allAttrs[1]);
0703: outFile.write("</Value>");
0704: outFile.write("\n </AttributeValuePair>");
0705: outFile.write("\n </ModifyDefaultValues>");
0706: outFile.write("\n </SchemaRequests>");
0707: }
0708: if (attrName
0709: .equalsIgnoreCase("iwtPlatform-availableLocales-at")) {
0710: outFile
0711: .write("\n <SchemaRequests serviceName=\"iPlanetAMPlatformService\" SchemaType=\"Global\">");
0712: outFile.write("\n <ModifyDefaultValues>");
0713: outFile.write("\n <AttributeValuePair>");
0714: outFile
0715: .write("\n <Attribute name=\"iplanet-am-platform-available-locales\"/>");
0716: for (int j = 1; j < allAttrs.length; ++j) {
0717: outFile
0718: .write("\n <Value>"
0719: + allAttrs[j]);
0720: outFile.write("</Value>");
0721: }
0722: outFile.write("\n </AttributeValuePair>");
0723: outFile.write("\n </ModifyDefaultValues>");
0724: outFile.write("\n </SchemaRequests>");
0725: }
0726: if (attrName.equalsIgnoreCase("iwtPlatform-locale-at")) {
0727: outFile
0728: .write("\n <SchemaRequests serviceName=\"iPlanetAMPlatformService\" SchemaType=\"Global\">");
0729: outFile.write("\n <ModifyDefaultValues>");
0730: outFile.write("\n <AttributeValuePair>");
0731: outFile
0732: .write("\n <Attribute name=\"iplanet-am-platform-locale\"/>");
0733: outFile.write("\n <Value>" + allAttrs[1]);
0734: outFile.write("</Value>");
0735: outFile.write("\n </AttributeValuePair>");
0736: outFile.write("\n </ModifyDefaultValues>");
0737: outFile.write("\n </SchemaRequests>");
0738: }
0739: if (attrName
0740: .equalsIgnoreCase("iwtDesktop-userSelectedProviders-at")) {
0741: outFile
0742: .write("\n <SchemaRequests serviceName=\"SunPortalDesktopService\" SchemaType=\"Dynamic\">");
0743: tabContainerFound = false;
0744: if (allAttrs.length > 1) {
0745: for (int jk = 1; jk < allAttrs.length; ++jk) {
0746: //System.out.println("Value of :"+allAttrs[jk]);
0747: if (allAttrs[jk]
0748: .equalsIgnoreCase("iwtTabProvider")) {
0749: tabContainerFound = true;
0750: //System.out.println("Found...");
0751: }
0752: }
0753: }
0754:
0755: outFile.write("\n <ModifyDefaultValues>");
0756: outFile.write("\n <AttributeValuePair>");
0757: outFile
0758: .write("\n <Attribute name=\"sunPortalDesktopDefaultChannelName\"/>");
0759: outFile.write("\n <Value>");
0760: if (tabContainerFound == true)
0761: outFile.write("TemplateTabContainer");
0762: else
0763: outFile.write("TemplateTableContainer");
0764: outFile.write("</Value>");
0765: outFile.write("\n </AttributeValuePair>");
0766: outFile.write("\n </ModifyDefaultValues>");
0767: outFile.write("\n </SchemaRequests>");
0768: }
0769: }
0770:
0771: }
0772:
0773: if (profiletype.equalsIgnoreCase("role"))
0774: org = dn.substring(3);
0775: //System.out.println("Value of org..."+org);
0776: if ((deriveAuthFromApp)
0777: && ((profiletype.equalsIgnoreCase("domain")))) {
0778: //If no customization in 3.0 w.r.t authentication modules, it just shows all.
0779: //Hence register and create service templates for all the modules provided.
0780:
0781: outFile.write("\n <OrganizationRequests DN=\"o=" + org
0782: + "," + rootsuffix + "\">");
0783: outFile.write("\n <RegisterServices>");
0784: outFile
0785: .write("\n <Service_Name>iPlanetAMAuthLDAPService</Service_Name>");
0786: outFile.write("\n </RegisterServices>");
0787: outFile.write("\n </OrganizationRequests>");
0788: outFile.write("\n <OrganizationRequests DN=\"o=" + org
0789: + "," + rootsuffix + "\">");
0790: outFile.write("\n <RegisterServices>");
0791: outFile
0792: .write("\n <Service_Name>iPlanetAMAuthAnonymousService</Service_Name>");
0793: outFile.write("\n </RegisterServices>");
0794: outFile.write("\n </OrganizationRequests>");
0795: outFile.write("\n <OrganizationRequests DN=\"o=" + org
0796: + "," + rootsuffix + "\">");
0797: outFile.write("\n <RegisterServices>");
0798: outFile
0799: .write("\n <Service_Name>iPlanetAMAuthMembershipService</Service_Name>");
0800: outFile.write("\n </RegisterServices>");
0801: outFile.write("\n </OrganizationRequests>");
0802: outFile.write("\n <OrganizationRequests DN=\"o=" + org
0803: + "," + rootsuffix + "\">");
0804: outFile.write("\n <RegisterServices>");
0805: outFile
0806: .write("\n <Service_Name>iPlanetAMAuthSafeWordService</Service_Name>");
0807: outFile.write("\n </RegisterServices>");
0808: outFile.write("\n </OrganizationRequests>");
0809: outFile.write("\n <OrganizationRequests DN=\"o=" + org
0810: + "," + rootsuffix + "\">");
0811: outFile.write("\n <RegisterServices>");
0812: outFile
0813: .write("\n <Service_Name>iPlanetAMAuthRadiusService</Service_Name>");
0814: outFile.write("\n </RegisterServices>");
0815: outFile.write("\n </OrganizationRequests>");
0816: outFile.write("\n <OrganizationRequests DN=\"o=" + org
0817: + "," + rootsuffix + "\">");
0818: outFile.write("\n <RegisterServices>");
0819: outFile
0820: .write("\n <Service_Name>iPlanetAMAuthUnixService</Service_Name>");
0821: outFile.write("\n </RegisterServices>");
0822: outFile.write("\n </OrganizationRequests>");
0823: outFile.write("\n <OrganizationRequests DN=\"o=" + org
0824: + "," + rootsuffix + "\">");
0825: outFile.write("\n <RegisterServices>");
0826: outFile
0827: .write("\n <Service_Name>iPlanetAMAuthCertService</Service_Name>");
0828: outFile.write("\n </RegisterServices>");
0829: outFile.write("\n </OrganizationRequests>");
0830: outFile.write("\n <OrganizationRequests DN=\""
0831: + constructOrgDN(org, rootsuffix) + "\">");
0832: outFile.write("\n <CreateServiceTemplate>");
0833: outFile
0834: .write("\n <Service_Name>iPlanetAMAuthLDAPService</Service_Name>");
0835: outFile.write("\n </CreateServiceTemplate>");
0836: outFile.write("\n </OrganizationRequests>");
0837: outFile.write("\n <OrganizationRequests DN=\""
0838: + constructOrgDN(org, rootsuffix) + "\">");
0839: outFile.write("\n <CreateServiceTemplate>");
0840: outFile
0841: .write("\n <Service_Name>iPlanetAMAuthMembershipService</Service_Name>");
0842: outFile.write("\n </CreateServiceTemplate>");
0843: outFile.write("\n </OrganizationRequests>");
0844:
0845: outFile.write("\n<OrganizationRequests DN=\""
0846: + constructOrgDN(org, rootsuffix) + "\">");
0847: outFile
0848: .write("\n <ModifyServiceTemplate serviceName=\"iPlanetAMAuthMembershipService\" schemaType=\"Organization\">");
0849: outFile.write("\n <AttributeValuePair>");
0850: outFile
0851: .write("\n <Attribute name=\"iplanet-am-auth-membership-base-dn\"/>");
0852: outFile.write("\n <Value>"
0853: + constructOrgDN(org, rootsuffix) + "</Value>");
0854: outFile.write("\n </AttributeValuePair>");
0855: outFile.write("\n <AttributeValuePair>");
0856: outFile
0857: .write("\n <Attribute name=\"iplanet-am-auth-membership-bind-passwd\"/>");
0858: outFile.write("\n <Value>" + ldapUserPasswd
0859: + "</Value>");
0860: outFile.write("\n </AttributeValuePair>");
0861: outFile.write("\n </ModifyServiceTemplate>");
0862: outFile.write("\n </OrganizationRequests>");
0863:
0864: outFile.write("\n <OrganizationRequests DN=\""
0865: + constructOrgDN(org, rootsuffix) + "\">");
0866: outFile.write("\n <CreateServiceTemplate>");
0867: outFile
0868: .write("\n <Service_Name>iPlanetAMAuthAnonymousService</Service_Name>");
0869: outFile.write("\n </CreateServiceTemplate>");
0870: outFile.write("\n </OrganizationRequests>");
0871: outFile.write("\n <OrganizationRequests DN=\""
0872: + constructOrgDN(org, rootsuffix) + "\">");
0873: outFile.write("\n <CreateServiceTemplate>");
0874: outFile
0875: .write("\n <Service_Name>iPlanetAMAuthSafeWordService</Service_Name>");
0876: outFile.write("\n </CreateServiceTemplate>");
0877: outFile.write("\n </OrganizationRequests>");
0878: outFile.write("\n <OrganizationRequests DN=\""
0879: + constructOrgDN(org, rootsuffix) + "\">");
0880: outFile.write("\n <CreateServiceTemplate>");
0881: outFile
0882: .write("\n <Service_Name>iPlanetAMAuthRadiusService</Service_Name>");
0883: outFile.write("\n </CreateServiceTemplate>");
0884: outFile.write("\n </OrganizationRequests>");
0885: outFile.write("\n <OrganizationRequests DN=\""
0886: + constructOrgDN(org, rootsuffix) + "\">");
0887: outFile.write("\n <CreateServiceTemplate>");
0888: outFile
0889: .write("\n <Service_Name>iPlanetAMAuthUnixService</Service_Name>");
0890: outFile.write("\n </CreateServiceTemplate>");
0891: outFile.write("\n </OrganizationRequests>");
0892: outFile.write("\n <OrganizationRequests DN=\""
0893: + constructOrgDN(org, rootsuffix) + "\">");
0894: outFile.write("\n <CreateServiceTemplate>");
0895: outFile
0896: .write("\n <Service_Name>iPlanetAMAuthCertService</Service_Name>");
0897: outFile.write("\n </CreateServiceTemplate>");
0898: outFile.write("\n </OrganizationRequests>");
0899: outFile.write("\n <OrganizationRequests DN=\""
0900: + constructOrgDN(org, rootsuffix) + "\">");
0901: outFile
0902: .write("\n <ModifyServiceTemplate serviceName=\"iPlanetAMAuthService\" schemaType=\"Organization\">");
0903: outFile.write("\n <AttributeValuePair>");
0904: outFile
0905: .write("\n <Attribute name=\"iplanet-am-auth-allowed-modules\"/>");
0906: outFile.write("\n <Value>LDAP</Value>");
0907: outFile.write("\n <Value>Anonymous</Value>");
0908: outFile.write("\n <Value>Membership</Value>");
0909: outFile.write("\n <Value>SafeWord</Value>");
0910: outFile.write("\n <Value>RADIUS</Value>");
0911: outFile.write("\n <Value>Unix</Value>");
0912: outFile.write("\n <Value>Cert</Value>");
0913: outFile.write("\n </AttributeValuePair>");
0914: outFile.write("\n </ModifyServiceTemplate>");
0915: outFile.write("\n </OrganizationRequests>");
0916: }
0917: return;
0918: }
0919:
0920: static String getOrgName(String dn) {
0921: String orgName = new String();
0922:
0923: //System.out.println("Orgname.."+dn);
0924: orgName = dn.substring(3, dn.indexOf(","));
0925: return orgName;
0926: }
0927:
0928: /*
0929: * The Global Desktop Service attributes need updated
0930: *
0931: * 1) sunPortalDesktopAuthorizedAuthlessUIDs = null
0932: * 2) sunPortalDesktopDefaultAuthlessUID = null
0933: *
0934: * Adding code to set the Console Service attributes also.
0935: * Without it, when a new user is created via the Memebership auth module
0936: * the Desktop Service is not available.
0937: *
0938: * @param outputFile the output file to write to
0939: */
0940: public static void setGlobalServiceAttr(String outputFile) {
0941:
0942: try {
0943: outFile = new OutputStreamWriter(new FileOutputStream(
0944: outputFile), "UTF-8");
0945: printHeader();
0946: outFile
0947: .write("\n <SchemaRequests serviceName=\"SunPortalDesktopService\""
0948: + " SchemaType=\"Global\">");
0949: outFile.write("\n <RemoveDefaultValues>");
0950: outFile
0951: .write("\n <Attribute name=\"sunPortalDesktopAuthorizedAuthlessUIDs\"/>");
0952: outFile
0953: .write("\n <Attribute name=\"sunPortalDesktopDefaultAuthlessUID\"/>");
0954: outFile.write("\n </RemoveDefaultValues>");
0955: outFile.write("\n </SchemaRequests>");
0956:
0957: outFile
0958: .write("\n <SchemaRequests serviceName=\"iPlanetAMAdminConsoleService\""
0959: + " SchemaType=\"Organization\">");
0960: outFile.write("\n <ModifyDefaultValues>");
0961: outFile.write("\n <AttributeValuePair>");
0962: outFile
0963: .write("\n <Attribute name=\"iplanet-am-required-services\"/>");
0964: outFile
0965: .write("\n <Value>SunPortalDesktopService</Value>");
0966: outFile
0967: .write("\n <Value>SunPortalNetmailService</Value>");
0968: outFile
0969: .write("\n <Value>iPlanetAMWebAgentService</Value>");
0970: outFile.write("\n </AttributeValuePair>");
0971: outFile.write("\n </ModifyDefaultValues>");
0972: outFile.write("\n </SchemaRequests>");
0973: outFile.write("\n</Requests>");
0974: outFile.close();
0975: } catch (Exception e) {
0976: System.out.println("Error:" + e.toString());
0977: e.printStackTrace();
0978: }
0979:
0980: }
0981:
0982: static String ConstructDN(String roleFileName) {
0983: String rolename;
0984: String tmp;
0985: String dnToRet;//The DN to be returned
0986:
0987: // Given the relative path of the current file. This function constructs the DN of the required Role i.e SUbORganization..*
0988:
0989: //System.out.println("PAth:"+roleFileName);
0990:
0991: dnToRet = new String();
0992: tmp = roleFileName;
0993: while (tmp.indexOf("/") >= 0) {
0994: //System.out.println("Temp:"+tmp);
0995: dnToRet += "," + orgNaming
0996: + tmp.substring(tmp.lastIndexOf("/") + 1);
0997: tmp = tmp.substring(0, tmp.lastIndexOf("/"));
0998: }
0999:
1000: //System.out.println("To return:"+dnToRet);
1001: return dnToRet;
1002: }
1003:
1004: static String setNetMailServiceAttributes(String attrName,
1005: String allAttrs[]) {
1006: StringBuffer sb = new StringBuffer();
1007: int attrType = -1;
1008:
1009: sb.append("\n <Attribute name=");
1010:
1011: attrType = attrType(attrName);
1012: switch (attrType) {
1013: case NETMAIL_USER_IMAP_SERVER:
1014: sb.append("\"sunPortalNetmailIMAPServerName\"/>");
1015: break;
1016:
1017: case NETMAIL_USER_SMTP_SERVER:
1018: sb.append("\"sunPortalNetmailSMTPServerName\"/>");
1019: break;
1020:
1021: case NETMAIL_USER_DEFAULTMAILDOMAIN:
1022: sb.append("\"sunPortalNetmailDefaultMailDomain\"/>");
1023: break;
1024:
1025: case NETMAIL_ROOT_FOLDER:
1026: sb.append("\"sunPortalNetmailRootFolder\"/>");
1027: break;
1028:
1029: case NETMAIL_SENT_FOLDER:
1030: sb.append("\"sunPortalNetmailSentMessagesFolder\"/>");
1031: break;
1032:
1033: case NETMAIL_REPLY_WITHAUTHOR:
1034: sb.append("\"sunPortalNetmailReplyWithAuthor\"/>");
1035: break;
1036:
1037: case NETMAIL_REPLY_WITHDATE:
1038: sb.append("\"sunPortalNetmailReplyWithDate\"/>");
1039: break;
1040:
1041: case NETMAIL_REPLY_WITHBODY:
1042: sb.append("\"sunPortalNetmailReplyWithBody\"/>");
1043: break;
1044:
1045: case NETMAIL_INDENT_PREFIX:
1046: sb.append("\"sunPortalNetmailIndentPrefix\"/>");
1047: break;
1048:
1049: case NETMAIL_ADD_SIGNATURE:
1050: sb.append("\"sunPortalNetmailAddSignature\"/>");
1051: break;
1052:
1053: case NETMAIL_INITIAL_HDRS:
1054: sb.append("\"sunPortalNetmailInitialHeaders\"/>");
1055: break;
1056:
1057: case NETMAIL_INACTIVITY_INTERVAL:
1058: sb.append("\"sunPortalNetmailInactivityInterval\"/>");
1059: break;
1060:
1061: case NETMAIL_MAX_ATTACH_LEN:
1062: sb.append("\"sunPortalNetmailMaxAttachLen\"/>");
1063: break;
1064:
1065: case NETMAIL_AUTOLOAD:
1066: sb.append("\"sunPortalNetmailAutoload\"/>");
1067: break;
1068:
1069: case NETMAIL_AUTOSAVE:
1070: sb.append("\"sunPortalNetmailAutosave\"/>");
1071: break;
1072:
1073: case NETMAIL_AUTOPURGE:
1074: sb.append("\"sunPortalNetmailAutopurge\"/>");
1075: break;
1076:
1077: case NETMAIL_AUTOFOLDERLOAD:
1078: sb.append("\"sunPortalNetmailAutoFolderLoad\"/>");
1079: break;
1080:
1081: case NETMAIL_MULTIPLE_RDW:
1082: sb.append("\"sunPortalNetmailMultipleReadWindows\"/>");
1083: break;
1084:
1085: case NETMAIL_HEADERS_PAGE:
1086: sb.append("\"sunPortalNetmailHeadersPerPage\"/>");
1087: break;
1088:
1089: case NETMAIL_NEWEST_FIRST:
1090: sb.append("\"sunPortalNetmailNewestFirst\"/>");
1091: break;
1092:
1093: case NETMAIL_LDAPSERVERS:
1094: sb.append("\"sunPortalNetmailLDAPServers\"/>");
1095: for (int i = 1; i < allAttrs.length; ++i)
1096: sb.append("\n <Value>" + allAttrs[i] + "</Value>");
1097: return sb.toString();//Multiple entries...appending and returning at this point
1098:
1099: case NETMAIL_NOPREFSLIST:
1100: sb.append("\"sunPortalNetmailNoPrefsList\"/>");
1101: for (int i = 1; i < allAttrs.length; ++i)
1102: sb.append("\n <Value>" + allAttrs[i] + "</Value>");
1103: return sb.toString();//Multiple entries...appending and returning at this point
1104:
1105: }
1106: sb.append("\n <Value>" + allAttrs[1] + "</Value>");
1107: return sb.toString();
1108: }
1109:
1110: static void InitHashMap() {
1111:
1112: ATTRIBUTES.put((new String("iwtUser-IMAPServerName-at"))
1113: .toLowerCase(), new Integer(NETMAIL_USER_IMAP_SERVER));
1114: ATTRIBUTES.put((new String("iwtUser-SMTPServerName-at"))
1115: .toLowerCase(), new Integer(NETMAIL_USER_SMTP_SERVER));
1116: ATTRIBUTES.put((new String("iwtUser-defaultMailDomain-at"))
1117: .toLowerCase(), new Integer(
1118: NETMAIL_USER_DEFAULTMAILDOMAIN));
1119: ATTRIBUTES.put((new String("iwtNetMail-rootFolder-at"))
1120: .toLowerCase(), new Integer(NETMAIL_ROOT_FOLDER));
1121: ATTRIBUTES.put((new String("iwtNetMail-sentMessagesFolder-at"))
1122: .toLowerCase(), new Integer(NETMAIL_SENT_FOLDER));
1123: ATTRIBUTES.put((new String("iwtNetMail-replyWithAuthor-at"))
1124: .toLowerCase(), new Integer(NETMAIL_REPLY_WITHAUTHOR));
1125: ATTRIBUTES.put((new String("iwtNetMail-replyWithDate-at"))
1126: .toLowerCase(), new Integer(NETMAIL_REPLY_WITHDATE));
1127: ATTRIBUTES.put((new String("iwtNetMail-replyWithBody-at"))
1128: .toLowerCase(), new Integer(NETMAIL_REPLY_WITHBODY));
1129: ATTRIBUTES.put((new String("iwtNetMail-indentPrefix-at"))
1130: .toLowerCase(), new Integer(NETMAIL_INDENT_PREFIX));
1131: ATTRIBUTES.put((new String("iwtNetMail-addSignature-at"))
1132: .toLowerCase(), new Integer(NETMAIL_ADD_SIGNATURE));
1133: ATTRIBUTES.put((new String("iwtNetMail-initialHeaders-at"))
1134: .toLowerCase(), new Integer(NETMAIL_INITIAL_HDRS));
1135: ATTRIBUTES.put((new String("iwtNetMail-inactivityInterval-at"))
1136: .toLowerCase(),
1137: new Integer(NETMAIL_INACTIVITY_INTERVAL));
1138: ATTRIBUTES.put((new String("iwtNetMail-maxAttachLen-at"))
1139: .toLowerCase(), new Integer(NETMAIL_MAX_ATTACH_LEN));
1140: ATTRIBUTES.put((new String("iwtNetMail-autoload-at"))
1141: .toLowerCase(), new Integer(NETMAIL_AUTOLOAD));
1142: ATTRIBUTES.put((new String("iwtNetMail-autosave-at"))
1143: .toLowerCase(), new Integer(NETMAIL_AUTOSAVE));
1144: ATTRIBUTES.put((new String("iwtNetMail-autopurge-at"))
1145: .toLowerCase(), new Integer(NETMAIL_AUTOPURGE));
1146: ATTRIBUTES.put((new String("iwtNetMail-autoFolderload-at"))
1147: .toLowerCase(), new Integer(NETMAIL_AUTOFOLDERLOAD));
1148: ATTRIBUTES.put(
1149: (new String("iwtNetMail-multipleReadWindows-at"))
1150: .toLowerCase(), new Integer(
1151: NETMAIL_MULTIPLE_RDW));
1152: ATTRIBUTES.put((new String("iwtNetMail-headersPerPage-at"))
1153: .toLowerCase(), new Integer(NETMAIL_HEADERS_PAGE));
1154: ATTRIBUTES.put((new String("iwtNetMail-newestFirst-at"))
1155: .toLowerCase(), new Integer(NETMAIL_NEWEST_FIRST));
1156: ATTRIBUTES.put((new String("iwtNetMail-LDAPServers-at"))
1157: .toLowerCase(), new Integer(NETMAIL_LDAPSERVERS));
1158: ATTRIBUTES.put((new String("iwtNetMail-noPrefsList-at"))
1159: .toLowerCase(), new Integer(NETMAIL_NOPREFSLIST));
1160:
1161: }
1162:
1163: static int attrType(String attrName) {
1164: /* Returns the type of attribute that is being handled currently....*/
1165:
1166: try {
1167: return ((Integer) ATTRIBUTES.get(attrName.toLowerCase()))
1168: .intValue();
1169: } catch (Exception e) {
1170: return -1;
1171: }
1172: }
1173:
1174: static OutputStreamWriter outOrgsList_LDAP;//List of org's with LDAP server authentication as internal is written to this.
1175:
1176: /*
1177: * Flat Role conversion helper method responsible for evaluating the profileid
1178: * and construnctin the conforming rolename.
1179: *
1180: * @param String representing the role.ldif profileid
1181: * @return String representing concatenated roles forming one rolename with
1182: * conforming to the flat role naming convention
1183: */
1184: static String getMangledRoleWithOrgFromProfileId(String profiledn) {
1185: String dn = profiledn;
1186: String orgName = dn.substring(1, dn.indexOf("/", 1));
1187:
1188: if (dn.indexOf("/", 1) >= 0) {
1189: dn = dn.substring(dn.indexOf("/", 1));
1190: }
1191:
1192: StringTokenizer strTok = new StringTokenizer(dn, "/");
1193: String roleName = "";
1194:
1195: while (strTok.hasMoreTokens()) {
1196: roleName += "_" + strTok.nextToken();
1197:
1198: if (roleName.startsWith("_")) {
1199: roleName = roleName.substring(1, roleName.length());
1200: }
1201: }
1202:
1203: return constructRoleDN(roleName, orgName);
1204: }
1205:
1206: }
|