Source Code Cross Referenced for NetfileConvert.java in  » Portal » Open-Portal » migration » modules » srap » ldap » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » Open Portal » migration.modules.srap.ldap 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * $Id: NetfileConvert.java,v 1.20 2003/07/04 09:20:59 mm132998 Exp $
0003:         * $Source: /m/portal/ps/srap/src/migration/modules/srap/ldap/Attic/NetfileConvert.java,v $
0004:         * $Log: NetfileConvert.java,v $
0005:         * Revision 1.20  2003/07/04 09:20:59  mm132998
0006:         * 3.0 -> 6.2 migration changes
0007:         *
0008:         * Revision 1.19  2003/06/20 13:19:54  mm132998
0009:         * Minor bug with commonhostdata
0010:         *
0011:         * Revision 1.18  2003/06/20 11:39:57  mm132998
0012:         * Initial changes for 6.2
0013:         *
0014:         * Revision 1.14.2.2.6.2  2003/04/10 14:35:09  mm132998
0015:         * Bug ID : 4845550
0016:         *
0017:         * Revision 1.14.2.2.6.1  2003/04/04 09:49:12  mm132998
0018:         * Migration changes for 3.0 -> 6.0.1
0019:         *
0020:         * Revision 1.14.2.2  2002/11/19 11:01:46  bv131302
0021:         * CRT#2047 - looking for installdir
0022:         *
0023:         * Revision 1.14.2.1  2002/09/30 10:48:25  bv131302
0024:         * LihueRtm_branch changes
0025:         *
0026:         * Revision 1.9.2.6  2002/09/23 19:46:13  mm132998
0027:         * CRT #1987
0028:         *
0029:         * Revision 1.16  2002/09/23 19:44:00  mm132998
0030:         * CRT #1987
0031:         *
0032:         * Revision 1.15  2002/09/21 19:20:07  mm132998
0033:         * CRT #1987
0034:         *
0035:         * Revision 1.9.2.4  2002/09/20 18:43:12  mm132998
0036:         * CRT 1972
0037:         *
0038:         * Revision 1.14  2002/09/20 18:34:42  mm132998
0039:         * CRT 1987
0040:         *
0041:         * Revision 1.13  2002/09/20 18:22:07  mm132998
0042:         * CRT #1987
0043:         *
0044:         * Revision 1.12  2002/09/18 19:47:01  mm132998
0045:         * CRT #1987
0046:         *
0047:         * Revision 1.9.2.2  2002/09/16 17:41:43  mm132998
0048:         * CRT 1972
0049:         *
0050:         * Revision 1.9.2.1  2002/09/11 15:15:57  bv131302
0051:         * CRT#1953, CRT1954, CRT#1950, CRT#1946, CRT#1940
0052:         *
0053:         * Revision 1.10  2002/09/10 14:39:14  mm132998
0054:         * CRT 1954
0055:         *
0056:         * Revision 1.9  2002/08/27 16:42:08  mm132998
0057:         * CRT : 1921
0058:         *
0059:         * Revision 1.8  2002/08/20 14:52:43  bv131302
0060:         * Commonhost data migration, gateway MaxSockets removed
0061:         *
0062:         * Revision 1.7  2002/08/19 15:04:04  bv131302
0063:         * commonhost data migration
0064:         *
0065:         * Revision 1.6  2002/08/14 12:34:19  mm132998
0066:         * CRT : 1868 , Bugs : 4730677 ,4730681 , 4730685
0067:         *
0068:         * Revision 1.5  2002/08/13 18:25:52  mm132998
0069:         * CRT : 1868 , Bugs : 4730677 ,4730681 , 4730685
0070:         *
0071:         * Revision 1.4  2002/07/31 02:29:14  mm132998
0072:         * Bug fixes
0073:         *
0074:         * Revision 1.3  2002/07/29 13:00:13  mm132998
0075:         * Bug fixes
0076:         *
0077:         * Revision 1.2  2002/07/22 08:47:29  mm132998
0078:         * Bug ID - 4718198 , Desc - Initial code changes
0079:         *
0080:         *
0081:         */
0082:        /**
0083:         * $Id: NetfileConvert.java,v 1.20 2003/07/04 09:20:59 mm132998 Exp $
0084:         * Copyright 2002 Sun Microsystems, Inc. All
0085:         * rights reserved. Use of this product is subject
0086:         * to license terms. Federal Acquisitions:
0087:         * Commercial Software -- Government Users
0088:         * Subject to Standard License Terms and
0089:         * Conditions.
0090:         *
0091:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
0092:         * are trademarks or registered trademarks of Sun Microsystems,
0093:         * Inc. in the United States and other countries.
0094:         */package migration.modules.srap.ldap;
0095:
0096:        import netscape.ldap.util.*;
0097:
0098:        import netscape.ldap.LDAPAttribute;
0099:        import netscape.ldap.LDAPAttributeSet;
0100:
0101:        import java.util.*;
0102:        import java.io.*;
0103:
0104:        public class NetfileConvert {
0105:
0106:            static FileWriter outFile;
0107:            static String rootsuffix;
0108:
0109:            static LinkedList orgList = new LinkedList();
0110:
0111:            private static final int ROLE_PROFILE = 1;
0112:            private static final int DOMAIN_PROFILE = 2;
0113:
0114:            private static String maxSearchDir = null;
0115:            private static String tempDir = null;
0116:            private static String ntDomain = null;
0117:
0118:            public static void main(String args[]) {
0119:
0120:                String outputDir, ldifDir;
0121:
0122:                ldifDir = new String();// Input file, the LDIF file to be converted....
0123:                outputDir = new String();
0124:
0125:                if (args.length == 3) {
0126:                    // defaultRulesFile also specified.
0127:                    loadDefaultValues(args[2]);
0128:                    outputDir = args[1];
0129:                    ldifDir = args[0];
0130:                } else if (args.length == 2) {
0131:                    outputDir = args[1];
0132:                    ldifDir = args[0];
0133:                } else if (args.length == 1) {
0134:                    outputDir = new String("/tmp/xml");
0135:                    ldifDir = args[0];
0136:                } else if (args.length == 0) {
0137:                    System.out
0138:                            .println("Input file to be converted not specified!");
0139:                    System.out
0140:                            .println("Invokation Format is:java NetfileConvert ldif_directory output_dir");
0141:                    System.exit(1);
0142:                }
0143:
0144:                doConvert(ldifDir + "/domain.ldif", outputDir
0145:                        + "/NetfileOrgAttrs.xml");
0146:                doConvert(ldifDir + "/role.ldif", outputDir
0147:                        + "/NetfileRoleAttrs.xml");
0148:                dumpOrganizationList(outputDir + "/orgList");
0149:                dumpPolicyList(outputDir + "/NetfilePolicies.xml");
0150:                System.exit(0);
0151:            }
0152:
0153:            private static void dumpPolicyList(String fileName) {
0154:                try {
0155:                    outFile = new FileWriter(fileName);
0156:                    printHeader();
0157:
0158:                    List orgContainerList = OrgContainerParser.parse(orgList,
0159:                            rootsuffix);
0160:                    Iterator iter = orgContainerList.iterator();
0161:
0162:                    while (iter.hasNext()) {
0163:                        OrgContainer org = (OrgContainer) iter.next();
0164:
0165:                        OrgContainerParser.writeReferalPolicy(outFile, org,
0166:                                "srapNetfileService", "Netfile");
0167:                        if (!org.isDummyOrg()) {
0168:                            // This is not a dummy root org that we added for populating referal policies.
0169:                            // So assign the policies.
0170:                            writePolicies(org);
0171:                        }
0172:                    }
0173:
0174:                    outFile.write("\n</Requests>");
0175:                    outFile.close();
0176:                } catch (Exception ex) {
0177:                    System.out
0178:                            .println("Exception while dumping policies xml file.\n");
0179:                    ex.printStackTrace();
0180:                }
0181:            }
0182:
0183:            private static void writePolicies(OrgContainer org)
0184:                    throws IOException {
0185:                // To create and assign the policy
0186:                outFile.write("<OrganizationRequests DN=\"" + org.getOrgName()
0187:                        + "\">\n");
0188:                outFile.write("<CreatePolicy createDN=\"" + org.getOrgName()
0189:                        + "\">\n");
0190:
0191:                outFile
0192:                        .write("    <Policy name=\"Ability to Execute SRAP Netfile\" referralPolicy=\"false\">\n");
0193:                outFile
0194:                        .write("    <Rule name=\"Ability to Execute SRAP Netfile\">\n");
0195:                outFile
0196:                        .write("    <ServiceName name=\"srapNetfileService\"/>\n");
0197:                outFile.write("        <AttributeValuePair>\n");
0198:                outFile
0199:                        .write("        <Attribute name=\"sunPortalNetfileExecute\"/>\n");
0200:                outFile.write("            <Value>true</Value>\n");
0201:                outFile.write("        </AttributeValuePair>\n");
0202:                outFile.write("    </Rule>\n");
0203:                outFile
0204:                        .write("    <Subjects name=\"OrgEnableNetfile\" description=\"\">\n");
0205:                outFile
0206:                        .write("      <Subject name=\"OrgEnableNetfile\" type=\"Organization\">\n");
0207:                outFile.write("        <AttributeValuePair>\n");
0208:                outFile.write("          <Attribute name=\"Values\"/>\n");
0209:                outFile.write("          <Value>" + org.getOrgName()
0210:                        + "</Value>\n");
0211:                outFile.write("        </AttributeValuePair>\n");
0212:                outFile.write("      </Subject>\n");
0213:                outFile.write("    </Subjects>\n");
0214:                outFile.write("    </Policy>\n");
0215:                outFile.write("</CreatePolicy>\n");
0216:                outFile.write("</OrganizationRequests>\n");
0217:
0218:                // Create policy "Cannot Execute SRAP Netfile" - which denies users access to Netfile.
0219:                // Create Role which has "Cannot Execute SRAP Netfile" Policy assigned to it.
0220:
0221:                outFile.write("\n <OrganizationRequests DN=\""
0222:                        + org.getOrgName() + "\">\n");
0223:
0224:                outFile
0225:                        .write("    <CreateRole createDN=\"Netfile Denied User Role\">\n");
0226:                outFile.write("        <AttributeValuePair>\n");
0227:                outFile
0228:                        .write("        <Attribute name=\"iplanet-am-role-description\"/>\n");
0229:                outFile
0230:                        .write("            <Value>Netfile Denied User Role</Value>\n");
0231:                outFile.write("        </AttributeValuePair>\n");
0232:                outFile.write("    </CreateRole>\n");
0233:                outFile.write("</OrganizationRequests>\n");
0234:
0235:                outFile.write("\n <OrganizationRequests DN=\""
0236:                        + org.getOrgName() + "\">\n");
0237:                outFile.write("<CreatePolicy createDN=\"" + org.getOrgName()
0238:                        + "\">\n");
0239:
0240:                outFile
0241:                        .write("    <Policy name=\"Cannot Execute SRAP Netfile\" referralPolicy=\"false\">\n");
0242:                outFile
0243:                        .write("    <Rule name=\"Ability to Execute SRAP Netfile\">\n");
0244:                outFile
0245:                        .write("    <ServiceName name=\"srapNetfileService\"/>\n");
0246:                outFile.write("        <AttributeValuePair>\n");
0247:                outFile
0248:                        .write("        <Attribute name=\"sunPortalNetfileExecute\"/>\n");
0249:                outFile.write("            <Value>false</Value>\n");
0250:                outFile.write("        </AttributeValuePair>\n");
0251:                outFile.write("    </Rule>\n");
0252:                outFile
0253:                        .write("    <Subjects name=\"OrgEnableNetfile\" description=\"\">\n");
0254:                outFile
0255:                        .write("      <Subject name=\"OrgEnableNetfile\" type=\"Organization\">\n");
0256:                outFile.write("        <AttributeValuePair>\n");
0257:                outFile.write("          <Attribute name=\"Values\"/>\n");
0258:                outFile.write("          <Value>");
0259:                outFile.write("\"cn=Netfile Denied User Role,"
0260:                        + org.getOrgName() + "\"");
0261:                outFile.write("</Value>\n");
0262:                outFile.write("        </AttributeValuePair>\n");
0263:                outFile.write("      </Subject>\n");
0264:                outFile.write("    </Subjects>\n");
0265:                outFile.write("    </Policy>\n");
0266:                outFile.write("</CreatePolicy>\n");
0267:                outFile.write("</OrganizationRequests>\n");
0268:            }
0269:
0270:            private static void loadDefaultValues(String fileName) {
0271:
0272:                maxSearchDir = null;
0273:                tempDir = null;
0274:                ntDomain = null;
0275:
0276:                try {
0277:                    LDIF l1 = new LDIF(fileName);
0278:
0279:                    LDIFRecord tmp = l1.nextRecord();
0280:                    LDIFAttributeContent con;
0281:                    LDAPAttribute[] attrList;
0282:                    LDAPAttributeSet theAttrSet = null;
0283:
0284:                    while (tmp != null) {
0285:                        if (tmp.getDN().trim().toLowerCase().indexOf(
0286:                                "iwtnetfile") != -1) {
0287:                            con = (LDIFAttributeContent) tmp.getContent();
0288:                            attrList = con.getAttributes();
0289:                            theAttrSet = new LDAPAttributeSet(attrList);
0290:                            for (int i = 0; i < attrList.length; ++i) {
0291:                                if (attrList[i].getName().equalsIgnoreCase(
0292:                                        "iwtNetFile-tempdir-at")) {
0293:                                    String[] allAttrs = (((LDAPAttribute) (theAttrSet
0294:                                            .getAttribute(attrList[i].getName())))
0295:                                            .getStringValueArray());
0296:                                    if (allAttrs.length > 1) {
0297:                                        tempDir = allAttrs[1];
0298:                                        if (tempDir.trim().length() == 0) {
0299:                                            tempDir = null;
0300:                                        }
0301:                                    }
0302:                                }
0303:                                if (attrList[i].getName().equalsIgnoreCase(
0304:                                        "iwtNetFile-maxsearchdir-at")) {
0305:                                    String[] allAttrs = (((LDAPAttribute) (theAttrSet
0306:                                            .getAttribute(attrList[i].getName())))
0307:                                            .getStringValueArray());
0308:                                    if (allAttrs.length > 1) {
0309:                                        maxSearchDir = allAttrs[1];
0310:                                        if (maxSearchDir.trim().length() == 0) {
0311:                                            maxSearchDir = null;
0312:                                        }
0313:                                    }
0314:                                }
0315:                                if (attrList[i].getName().equalsIgnoreCase(
0316:                                        "iwtNetFile-ntdomain-at")) {
0317:                                    String[] allAttrs = (((LDAPAttribute) (theAttrSet
0318:                                            .getAttribute(attrList[i].getName())))
0319:                                            .getStringValueArray());
0320:                                    if (allAttrs.length > 1) {
0321:                                        ntDomain = allAttrs[1];
0322:                                        if (ntDomain.trim().length() == 0) {
0323:                                            ntDomain = null;
0324:                                        }
0325:                                    }
0326:                                }
0327:                            }
0328:                        }
0329:                        tmp = l1.nextRecord();
0330:                    }
0331:                } catch (Exception ex) {
0332:                }
0333:            }
0334:
0335:            private static void dumpOrganizationList(String fileName) {
0336:                try {
0337:                    Iterator iter = orgList.iterator();
0338:                    String org;
0339:                    FileWriter orgListFile = new FileWriter(fileName);
0340:
0341:                    while (iter.hasNext()) {
0342:                        orgListFile.write(iter.next().toString());
0343:                        orgListFile.write("\n");
0344:                    }
0345:                    orgListFile.close();
0346:                } catch (IOException ioex) {
0347:                    ioex.printStackTrace();
0348:                } catch (Exception ex) {
0349:                    ex.printStackTrace();
0350:                }
0351:            }
0352:
0353:            public static void doConvert(String ldiffile, String outputfile) {
0354:                LDIFRecord out;
0355:                int count = 0;
0356:                LDIF l1;
0357:
0358:                try {
0359:                    l1 = new LDIF(ldiffile);
0360:                    //			convertedFile=new LDIFWriter(new PrintWriter(new FileOutputStream(outputfile)));
0361:
0362:                    outFile = new FileWriter(outputfile);
0363:
0364:                    System.out
0365:                            .println("Converting LDIF entries corr. to users from file:"
0366:                                    + ldiffile + ".....\n");
0367:
0368:                    LDIFRecord tmp = l1.nextRecord();
0369:
0370:                    printHeader();
0371:                    while (tmp != null) {
0372:                        ProcessRecord(tmp);
0373:                        tmp = l1.nextRecord();
0374:                    }
0375:                    outFile.write("\n</Requests>");
0376:                    outFile.close();
0377:                    System.out
0378:                            .println("Output available in file " + outputfile);
0379:                } catch (Exception e) {
0380:                    System.out.println("Error:" + e.toString());
0381:                    e.printStackTrace();
0382:                }
0383:            }
0384:
0385:            static void printHeader() throws Exception {
0386:
0387:                Locale locale = Locale.getDefault();
0388:                ResourceBundle ambundle;
0389:                ambundle = ResourceBundle.getBundle("AMConfig");
0390:                String IDSAMEBaseDir = new String();
0391:
0392:                if (ambundle.getObject("com.iplanet.am.rootsuffix") != null)
0393:                    rootsuffix = (String) (ambundle
0394:                            .getObject("com.iplanet.am.rootsuffix"));
0395:                if (ambundle.getObject("com.iplanet.am.installdir") != null) {
0396:                    IDSAMEBaseDir = (String) (ambundle
0397:                            .getObject("com.iplanet.am.installdir"));
0398:                    IDSAMEBaseDir = IDSAMEBaseDir.substring(0, IDSAMEBaseDir
0399:                            .indexOf("SUNWam"));
0400:                }
0401:                outFile
0402:                        .write("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
0403:                outFile
0404:                        .write("\n<!--  PROPRIETARY/CONFIDENTIAL/ Use of this product is subject");
0405:                outFile
0406:                        .write("\n to license terms. Copyright 2001 Sun Microsystems Inc.");
0407:                outFile
0408:                        .write("Some preexisting portions Copyright 2001 Netscape");
0409:                outFile.write("Communications Corp. All rights reserved. -->");
0410:                outFile
0411:                        .write("\n<!DOCTYPE Requests PUBLIC \"-//iPlanet//iDSAME 5.0 Admin CLI DTD//EN \" ");
0412:                outFile.write("\"file:" + IDSAMEBaseDir
0413:                        + "SUNWam/dtd/amAdmin.dtd\">");
0414:
0415:                outFile.write("\n<Requests>");
0416:                return;
0417:            }
0418:
0419:            static void ProcessRecord(LDIFRecord toConvert) throws Exception {
0420:                LDIFAttributeContent con;
0421:                LDAPAttributeSet theAttrSet;
0422:                String[] allAttrs;
0423:                String attrName;
0424:                String org, profiletype, rolename, parent, dn, profileid;
0425:                boolean tabContainerFound = false;
0426:                boolean authModulesToAdd = false;
0427:                int count;
0428:
0429:                int profileTypeId;
0430:
0431:                boolean isMaxSearchDir = false;
0432:                boolean isTempDir = false;
0433:                boolean isNtDomain = false;
0434:
0435:                LDAPAttribute[] attrList;
0436:
0437:                profiletype = parent = rolename = profileid = null;
0438:                org = getOrgName(toConvert.getDN());
0439:                dn = new String();
0440:
0441:                con = (LDIFAttributeContent) toConvert.getContent();
0442:                attrList = con.getAttributes();
0443:                theAttrSet = new LDAPAttributeSet(attrList);
0444:                for (int i = 0; i < attrList.length; ++i) {
0445:                    if ((attrList[i].getName()).equalsIgnoreCase("profiletype")) {
0446:                        allAttrs = (((LDAPAttribute) (theAttrSet
0447:                                .getAttribute(attrList[i].getName())))
0448:                                .getStringValueArray());
0449:                        profiletype = allAttrs[0];
0450:                    }
0451:                    if ((attrList[i].getName()).equalsIgnoreCase("profileid")) {
0452:                        allAttrs = (((LDAPAttribute) (theAttrSet
0453:                                .getAttribute(attrList[i].getName())))
0454:                                .getStringValueArray());
0455:                        profileid = allAttrs[0];
0456:                    }
0457:                    if ((attrList[i].getName()).equalsIgnoreCase("cn")) {
0458:                        allAttrs = (((LDAPAttribute) (theAttrSet
0459:                                .getAttribute(attrList[i].getName())))
0460:                                .getStringValueArray());
0461:                        rolename = allAttrs[0];
0462:                    }
0463:                    if ((attrList[i].getName()).equalsIgnoreCase("parent")) {
0464:                        allAttrs = (((LDAPAttribute) (theAttrSet
0465:                                .getAttribute(attrList[i].getName())))
0466:                                .getStringValueArray());
0467:                        parent = allAttrs[0];
0468:                    }
0469:                }
0470:                if (profiletype.equalsIgnoreCase("role"))
0471:                    profileTypeId = ROLE_PROFILE;
0472:                else
0473:                    profileTypeId = DOMAIN_PROFILE;
0474:
0475:                if (profileTypeId == ROLE_PROFILE)
0476:                    dn = ConstructDN(profileid);
0477:
0478:                String fqOrgDN = null;
0479:                if (profileTypeId == DOMAIN_PROFILE) {
0480:                    fqOrgDN = "o=" + org + "," + rootsuffix;
0481:                }
0482:                if (profileTypeId == ROLE_PROFILE) {
0483:                    fqOrgDN = dn.substring(1) + "," + rootsuffix;
0484:                }
0485:                if (fqOrgDN != null && !orgList.contains(fqOrgDN)) {
0486:                    orgList.add(fqOrgDN);
0487:                }
0488:
0489:                /* Registering netfileSErvice */
0490:                /*
0491:                if(profileTypeId == DOMAIN_PROFILE)
0492:                    outFile.write("\n <OrganizationRequests DN=\"o="+org+","+rootsuffix+"\">");
0493:                if(profileTypeId == ROLE_PROFILE)
0494:                    outFile.write("\n <OrganizationRequests DN=\""+dn.substring(1)+","+rootsuffix+"\">");
0495:                 */
0496:                outFile.write("\n <OrganizationRequests DN=\"" + fqOrgDN
0497:                        + "\">");
0498:                outFile.write("\n    <RegisterServices>");
0499:                outFile
0500:                        .write("\n        <Service_Name>srapNetFileService</Service_Name>");
0501:                outFile.write("\n    </RegisterServices>");
0502:                outFile.write("\n </OrganizationRequests>");
0503:
0504:                /* Creating the Service template stuff..*/
0505:                /*
0506:                if(profileTypeId == DOMAIN_PROFILE)
0507:                    outFile.write("\n <OrganizationRequests DN=\"o="+org+","+rootsuffix+"\">");
0508:                if(profileTypeId == ROLE_PROFILE)
0509:                    outFile.write("\n <OrganizationRequests DN=\""+dn.substring(1)+","+rootsuffix+"\">");
0510:                 */
0511:                outFile.write("\n <OrganizationRequests DN=\"" + fqOrgDN
0512:                        + "\">");
0513:
0514:                //outFile.write("<CreateServiceTemplate serviceName=\"srapNetFileService\"/>");
0515:                outFile.write("<CreateServiceTemplate>\n");
0516:                outFile
0517:                        .write("    <Service_Name>srapNetFileService</Service_Name>");
0518:                outFile.write("</CreateServiceTemplate>");
0519:                outFile.write("\n </OrganizationRequests>\n");
0520:
0521:                /*
0522:                if(profileTypeId == DOMAIN_PROFILE){
0523:                    outFile.write("\n <OrganizationRequests DN=\"o="+org+","+rootsuffix+"\">\n");
0524:                }
0525:
0526:                if(profileTypeId == ROLE_PROFILE){
0527:                    outFile.write("\n <OrganizationRequests DN=\""+dn.substring(1)+","+rootsuffix+"\">\n");
0528:                }
0529:                 */
0530:                outFile.write("\n <OrganizationRequests DN=\"" + fqOrgDN
0531:                        + "\">\n");
0532:
0533:                outFile
0534:                        .write("    <CreateRole createDN=\"NetFile Denied User Role\">");
0535:                outFile.write("        <AttributeValuePair>\n");
0536:                outFile
0537:                        .write("        <Attribute name=\"iplanet-am-role-description\"/>\n");
0538:                outFile
0539:                        .write("            <Value>NetFile Denied User Role</Value>\n");
0540:                outFile.write("        </AttributeValuePair>\n");
0541:                outFile.write("    </CreateRole>\n");
0542:                outFile.write("</OrganizationRequests>\n");
0543:
0544:                for (int i = 0; i < attrList.length; ++i) {
0545:                    attrName = attrList[i].getName();
0546:                    allAttrs = (((LDAPAttribute) (theAttrSet
0547:                            .getAttribute(attrList[i].getName())))
0548:                            .getStringValueArray());
0549:                    /* Setting the dynamic attributes pertaining to Netfile.
0550:                     * List of attributes being taken care of:
0551:                     * 			+ iwtNetFile-allowchgdomain
0552:                     * 			+ iwtNetFile-allowchguser
0553:                     * 			+ iwtNetFile-allowdelete
0554:                     * 			+ iwtNetFile-chghostlist
0555:                     * 			+ iwtNetFile-accesswin
0556:                     * 			+ iwtNetFile-accessftp
0557:                     * 			+ iwtNetFile-accessnfs
0558:                     * 			+ iwtNetFile-accessnetware
0559:                     * 			+ iwtNetFile-winsize
0560:                     * 			+ iwtNetFile-winloc
0561:                     * 			+ iwtNetFile-maxsearchdir
0562:                     *                      + iwtNetFile-ntdomain-at
0563:                     */
0564:                    if (attrName
0565:                            .equalsIgnoreCase("iwtNetFile-allowchgdomain-pv-ac-")
0566:                            && allAttrs.length > 0
0567:                            && allAttrs[0].trim().length() > 0) {
0568:                        /*
0569:                        if(profileTypeId == DOMAIN_PROFILE)
0570:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole,o="+org+","+rootsuffix+"\">");
0571:                        if(profileTypeId == ROLE_PROFILE)
0572:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole"+dn+","+rootsuffix+"\">");
0573:                         */
0574:                        outFile.write("\n <OrganizationRequests DN=\""
0575:                                + fqOrgDN + "\">");
0576:                        outFile
0577:                                .write("\n   <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0578:                        outFile.write("\n     <AttributeValuePair>");
0579:                        outFile
0580:                                .write("\n        <Attribute name=\"sunPortalNetFileAllowChangeDomain\"/>");
0581:                        outFile.write("\n        <Value>" + allAttrs[0]);
0582:                        outFile.write("</Value>");
0583:                        outFile.write("\n    </AttributeValuePair>");
0584:                        outFile.write("\n   </ModifyServiceTemplate>");
0585:                        outFile.write("\n </OrganizationRequests>");
0586:                    }
0587:                    if (attrName
0588:                            .equalsIgnoreCase("iwtNetFile-allowchguserid-pv-ac-")
0589:                            && allAttrs.length > 0
0590:                            && allAttrs[0].trim().length() > 0) {
0591:                        /*
0592:                        if(profileTypeId == DOMAIN_PROFILE)
0593:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole,o="+org+","+rootsuffix+"\">");
0594:                        if(profileTypeId == ROLE_PROFILE)
0595:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole"+dn+","+rootsuffix+"\">");
0596:                         */
0597:                        outFile.write("\n <OrganizationRequests DN=\""
0598:                                + fqOrgDN + "\">");
0599:                        outFile
0600:                                .write("\n   <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0601:                        outFile.write("\n     <AttributeValuePair>");
0602:                        outFile
0603:                                .write("\n        <Attribute name=\"sunPortalNetFileAllowChangeUserId\"/>");
0604:                        outFile.write("\n        <Value>" + allAttrs[0]);
0605:                        outFile.write("</Value>");
0606:                        outFile.write("\n    </AttributeValuePair>");
0607:                        outFile.write("\n   </ModifyServiceTemplate>");
0608:                        outFile.write("\n </OrganizationRequests>");
0609:                    }
0610:                    if (attrName
0611:                            .equalsIgnoreCase("iwtNetFile-allowdelete-pv-ac-")
0612:                            && allAttrs.length > 0
0613:                            && allAttrs[0].trim().length() > 0) {
0614:                        /*
0615:                        if(profileTypeId == DOMAIN_PROFILE)
0616:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole,o="+org+","+rootsuffix+"\">");
0617:                        if(profileTypeId == ROLE_PROFILE)
0618:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole"+dn+","+rootsuffix+"\">");
0619:                         */
0620:                        outFile.write("\n <OrganizationRequests DN=\""
0621:                                + fqOrgDN + "\">");
0622:                        outFile
0623:                                .write("\n   <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0624:                        outFile.write("\n     <AttributeValuePair>");
0625:                        outFile
0626:                                .write("\n        <Attribute name=\"sunPortalNetFileAllowDelete\"/>");
0627:                        outFile.write("\n        <Value>" + allAttrs[0]);
0628:                        outFile.write("</Value>");
0629:                        outFile.write("\n    </AttributeValuePair>");
0630:                        outFile.write("\n   </ModifyServiceTemplate>");
0631:                        outFile.write("\n </OrganizationRequests>");
0632:                    }
0633:                    if (attrName
0634:                            .equalsIgnoreCase("iwtNetFile-chghostlist-pv-de-")
0635:                            && allAttrs.length > 0) {
0636:                        /*
0637:                        if(profileTypeId == DOMAIN_PROFILE)
0638:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole,o="+org+","+rootsuffix+"\">");
0639:                        if(profileTypeId == ROLE_PROFILE)
0640:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole"+dn+","+rootsuffix+"\">");
0641:                         */
0642:                        if (allAttrs.length == 1
0643:                                && allAttrs[0].trim().length() == 0) {
0644:                            ;
0645:                        } else {
0646:                            outFile.write("\n <OrganizationRequests DN=\""
0647:                                    + fqOrgDN + "\">");
0648:                            outFile
0649:                                    .write("\n   <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0650:                            outFile.write("\n     <AttributeValuePair>");
0651:                            outFile
0652:                                    .write("\n        <Attribute name=\"sunPortalNetFileDeniedHostList\"/>");
0653:                            count = 0;
0654:                            while (count < allAttrs.length) {
0655:                                outFile.write("\n        <Value>"
0656:                                        + allAttrs[count] + "</Value>");
0657:                                count++;
0658:                            }
0659:                            //outFile.write("</Value>");
0660:                            outFile.write("\n    </AttributeValuePair>");
0661:                            outFile.write("\n   </ModifyServiceTemplate>");
0662:                            outFile.write("\n </OrganizationRequests>");
0663:                        }
0664:                    }
0665:
0666:                    if (attrName
0667:                            .equalsIgnoreCase("iwtNetFile-chghostlist-pv-al-")
0668:                            && allAttrs.length > 0) {
0669:                        /*
0670:                        if(profileTypeId == DOMAIN_PROFILE)
0671:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole,o="+org+","+rootsuffix+"\">");
0672:                        if(profileTypeId == ROLE_PROFILE)
0673:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole"+dn+","+rootsuffix+"\">");
0674:                         */
0675:                        if (allAttrs.length == 1
0676:                                && allAttrs[0].trim().length() == 0) {
0677:                            ;
0678:                        } else {
0679:                            outFile.write("\n <OrganizationRequests DN=\""
0680:                                    + fqOrgDN + "\">");
0681:                            outFile
0682:                                    .write("\n   <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0683:                            outFile.write("\n     <AttributeValuePair>");
0684:                            outFile
0685:                                    .write("\n        <Attribute name=\"sunPortalNetFileAllowedHostList\"/>");
0686:                            count = 0;
0687:                            while (count < allAttrs.length) {
0688:                                outFile.write("\n        <Value>"
0689:                                        + allAttrs[count] + "</Value>");
0690:                                count++;
0691:                            }
0692:                            //outFile.write("</Value>");
0693:                            outFile.write("\n    </AttributeValuePair>");
0694:                            outFile.write("\n   </ModifyServiceTemplate>");
0695:                            outFile.write("\n </OrganizationRequests>");
0696:                        }
0697:                    }
0698:
0699:                    if (attrName.equalsIgnoreCase("iwtNetFile-accesswin-at")
0700:                            && allAttrs.length > 1
0701:                            && allAttrs[1].trim().length() > 0) {
0702:                        /*
0703:                        if(profileTypeId == DOMAIN_PROFILE)
0704:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole,o="+org+","+rootsuffix+"\">");
0705:                        if(profileTypeId == ROLE_PROFILE)
0706:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole"+dn+","+rootsuffix+"\">");
0707:                         */
0708:                        outFile.write("\n <OrganizationRequests DN=\""
0709:                                + fqOrgDN + "\">");
0710:                        outFile
0711:                                .write("\n   <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0712:                        outFile.write("\n     <AttributeValuePair>");
0713:                        outFile
0714:                                .write("\n        <Attribute name=\"sunPortalNetFileAccessWin\"/>");
0715:                        outFile.write("\n        <Value>" + allAttrs[1]);
0716:                        outFile.write("</Value>");
0717:                        outFile.write("\n    </AttributeValuePair>");
0718:                        outFile.write("\n   </ModifyServiceTemplate>");
0719:                        outFile.write("\n </OrganizationRequests>");
0720:                    }
0721:                    if (attrName.equalsIgnoreCase("iwtNetFile-accessftp-at")
0722:                            && allAttrs.length > 1
0723:                            && allAttrs[1].trim().length() > 0) {
0724:                        /*
0725:                        if(profileTypeId == DOMAIN_PROFILE)
0726:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole,o="+org+","+rootsuffix+"\">");
0727:                        if(profileTypeId == ROLE_PROFILE)
0728:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole"+dn+","+rootsuffix+"\">");
0729:                         */
0730:                        outFile.write("\n <OrganizationRequests DN=\""
0731:                                + fqOrgDN + "\">");
0732:                        outFile
0733:                                .write("\n   <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0734:                        outFile.write("\n     <AttributeValuePair>");
0735:                        outFile
0736:                                .write("\n        <Attribute name=\"sunPortalNetFileAccessFTP\"/>");
0737:                        outFile.write("\n        <Value>" + allAttrs[1]);
0738:                        outFile.write("</Value>");
0739:                        outFile.write("\n    </AttributeValuePair>");
0740:                        outFile.write("\n   </ModifyServiceTemplate>");
0741:                        outFile.write("\n </OrganizationRequests>");
0742:                    }
0743:                    if (attrName.equalsIgnoreCase("iwtNetFile-accessnfs-at")
0744:                            && allAttrs.length > 1
0745:                            && allAttrs[1].trim().length() > 0) {
0746:                        /*
0747:                        if(profileTypeId == DOMAIN_PROFILE)
0748:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole,o="+org+","+rootsuffix+"\">");
0749:                        if(profileTypeId == ROLE_PROFILE)
0750:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole"+dn+","+rootsuffix+"\">");
0751:                         */
0752:                        outFile.write("\n <OrganizationRequests DN=\""
0753:                                + fqOrgDN + "\">");
0754:                        outFile
0755:                                .write("\n   <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0756:                        outFile.write("\n     <AttributeValuePair>");
0757:                        outFile
0758:                                .write("\n        <Attribute name=\"sunPortalNetFileAccessNFS\"/>");
0759:                        outFile.write("\n        <Value>" + allAttrs[1]);
0760:                        outFile.write("</Value>");
0761:                        outFile.write("\n    </AttributeValuePair>");
0762:                        outFile.write("\n   </ModifyServiceTemplate>");
0763:                        outFile.write("\n </OrganizationRequests>");
0764:                    }
0765:                    if (attrName
0766:                            .equalsIgnoreCase("iwtNetFile-accessnetware-at")
0767:                            && allAttrs.length > 1
0768:                            && allAttrs[1].trim().length() > 0) {
0769:                        /*
0770:                        if(profileTypeId == DOMAIN_PROFILE)
0771:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole,o="+org+","+rootsuffix+"\">");
0772:                        if(profileTypeId == ROLE_PROFILE)
0773:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole"+dn+","+rootsuffix+"\">");
0774:                         */
0775:                        outFile.write("\n <OrganizationRequests DN=\""
0776:                                + fqOrgDN + "\">");
0777:                        outFile
0778:                                .write("\n   <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0779:                        outFile.write("\n     <AttributeValuePair>");
0780:                        outFile
0781:                                .write("\n        <Attribute name=\"sunPortalNetFileAccessNetware\"/>");
0782:                        outFile.write("\n        <Value>" + allAttrs[1]);
0783:                        outFile.write("</Value>");
0784:                        outFile.write("\n    </AttributeValuePair>");
0785:                        outFile.write("\n   </ModifyServiceTemplate>");
0786:                        outFile.write("\n </OrganizationRequests>");
0787:                    }
0788:                    if (attrName.equalsIgnoreCase("iwtNetFile-winsize-at")
0789:                            && allAttrs.length > 1
0790:                            && allAttrs[1].trim().length() > 0) {
0791:                        /*
0792:                        if(profileTypeId == DOMAIN_PROFILE)
0793:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole,o="+org+","+rootsuffix+"\">");
0794:                        if(profileTypeId == ROLE_PROFILE)
0795:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole"+dn+","+rootsuffix+"\">");
0796:                         */
0797:                        outFile.write("\n <OrganizationRequests DN=\""
0798:                                + fqOrgDN + "\">");
0799:                        outFile
0800:                                .write("\n   <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0801:                        outFile.write("\n     <AttributeValuePair>");
0802:                        outFile
0803:                                .write("\n        <Attribute name=\"sunPortalNetFileWindowSize\"/>");
0804:                        outFile.write("\n        <Value>" + allAttrs[1]);
0805:                        outFile.write("</Value>");
0806:                        outFile.write("\n    </AttributeValuePair>");
0807:                        outFile.write("\n   </ModifyServiceTemplate>");
0808:                        outFile.write("\n </OrganizationRequests>");
0809:                    }
0810:                    if (attrName.equalsIgnoreCase("iwtNetFile-winloc-at")
0811:                            && allAttrs.length > 1
0812:                            && allAttrs[1].trim().length() > 0) {
0813:                        /*
0814:                        if(profileTypeId == DOMAIN_PROFILE)
0815:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole,o="+org+","+rootsuffix+"\">");
0816:                        if(profileTypeId == ROLE_PROFILE)
0817:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole"+dn+","+rootsuffix+"\">");
0818:                         */
0819:                        outFile.write("\n <OrganizationRequests DN=\""
0820:                                + fqOrgDN + "\">");
0821:                        outFile
0822:                                .write("\n   <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0823:                        outFile.write("\n     <AttributeValuePair>");
0824:                        outFile
0825:                                .write("\n        <Attribute name=\"sunPortalNetFileWindowLocation\"/>");
0826:                        outFile.write("\n        <Value>" + allAttrs[1]);
0827:                        outFile.write("</Value>");
0828:                        outFile.write("\n    </AttributeValuePair>");
0829:                        outFile.write("\n   </ModifyServiceTemplate>");
0830:                        outFile.write("\n </OrganizationRequests>");
0831:                    }
0832:                    if (attrName.equalsIgnoreCase("iwtNetFile-maxsearchdir-at")
0833:                            && allAttrs.length > 1
0834:                            && allAttrs[1].trim().length() > 0) {
0835:                        /*
0836:                        if(profileTypeId == DOMAIN_PROFILE)
0837:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole,o="+org+","+rootsuffix+"\">");
0838:                        if(profileTypeId == ROLE_PROFILE)
0839:                            outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole"+dn+","+rootsuffix+"\">");
0840:                         */
0841:                        outFile.write("\n <OrganizationRequests DN=\""
0842:                                + fqOrgDN + "\">");
0843:                        outFile
0844:                                .write("\n   <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0845:                        outFile.write("\n     <AttributeValuePair>");
0846:                        outFile
0847:                                .write("\n        <Attribute name=\"sunPortalNetFileMaxSearchDir\"/>");
0848:                        outFile.write("\n        <Value>" + allAttrs[1]);
0849:                        outFile.write("</Value>");
0850:                        outFile.write("\n    </AttributeValuePair>");
0851:                        outFile.write("\n   </ModifyServiceTemplate>");
0852:                        outFile.write("\n </OrganizationRequests>");
0853:                        isMaxSearchDir = true;
0854:                    }
0855:
0856:                    if (attrName
0857:                            .equalsIgnoreCase("iwtNetFile-commonhostdata-at")
0858:                            && allAttrs.length > 1) {
0859:                        /*
0860:                        if(profileTypeId == DOMAIN_PROFILE)
0861:                            outFile.write("\n<OrganizationRequests DN=\"o="+org+","+rootsuffix+"\">");
0862:                        if(profileTypeId == ROLE_PROFILE)
0863:                            outFile.write("\n<OrganizationRequests DN=\""+dn.trim().substring(1)+","+rootsuffix+"\">");
0864:                         */
0865:                        if (allAttrs.length == 2
0866:                                && allAttrs[1].trim().length() == 0) {
0867:                            ;
0868:                        } else {
0869:                            //outFile.write("\n<OrganizationRequests DN=\""+fqOrgDN+"\">");
0870:                            outFile.write("\n <OrganizationRequests DN=\""
0871:                                    + fqOrgDN + "\">");
0872:                            outFile
0873:                                    .write("\n    <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0874:                            outFile.write("\n       <AttributeValuePair>");
0875:                            outFile
0876:                                    .write("\n           <Attribute name=\"sunPortalNetFileCommonHostData\"/>");
0877:                            int tmpOffset = 1;
0878:                            /*
0879:                             * Looks like - 
0880:                             * 1) There can be multiple entries for common host data in 3.0
0881:                             * 2) 6.0 multiple entries have to be seperated by '\n'
0882:                             */
0883:
0884:                            while (tmpOffset < allAttrs.length) {
0885:                                Object convertedValue = NetfileUtil
0886:                                        .getHostTypePassShareAttrb(
0887:                                                allAttrs[tmpOffset],
0888:                                                NetfileUtil.SINGLE_STRING);
0889:                                tmpOffset++;
0890:                                if (convertedValue != null) {
0891:                                    outFile.write("\n    <Value>");
0892:                                    outFile.write(convertedValue.toString());
0893:                                    outFile.write("\n    </Value>");
0894:                                }
0895:                            }
0896:                            outFile.write("\n       </AttributeValuePair>");
0897:                            outFile.write("\n    </ModifyServiceTemplate>");
0898:                            //outFile.write("\n</OrganizationRequests>");
0899:                            outFile.write("\n </OrganizationRequests>");
0900:                        }
0901:                    }
0902:
0903:                    /* Setting the Organization attributes pertaining to Netfile.
0904:                     * List of attributes :
0905:                     * 			+ iwtNetFile-tempdir
0906:                     * 			+ iwtNetFile-debug
0907:                     * 			+ iwtNetFile-OScharset
0908:                     * 			+ iwtNetFile-commonhostdata
0909:                     */
0910:
0911:                    //if(profileTypeId == DOMAIN_PROFILE){
0912:                    if (attrName.equalsIgnoreCase("iwtNetFile-tempdir-at")
0913:                            && allAttrs.length > 1
0914:                            && allAttrs[1].trim().length() > 0) {
0915:                        outFile.write("\n<OrganizationRequests DN=\"" + fqOrgDN
0916:                                + "\">");
0917:                        //outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole,"+fqOrgDN+"\">");
0918:                        outFile
0919:                                .write("\n    <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0920:                        outFile.write("\n       <AttributeValuePair>");
0921:                        outFile
0922:                                .write("\n           <Attribute name=\"sunPortalNetFileTempDir\"/>");
0923:                        outFile.write("\n        <Value>" + allAttrs[1]);
0924:                        outFile.write("</Value>");
0925:                        outFile.write("\n       </AttributeValuePair>");
0926:                        outFile.write("\n    </ModifyServiceTemplate>");
0927:                        outFile.write("\n</OrganizationRequests>");
0928:                        //outFile.write("\n </RoleRequests>");
0929:                        isTempDir = true;
0930:                    }
0931:                    /*
0932:                    if(attrName.equalsIgnoreCase("iwtNetFile-debug-at") && allAttrs.length > 1
0933:                        && allAttrs[1].trim().length() == 0){
0934:                        outFile.write("\n<OrganizationRequests DN=\""+fqOrgDN+"\">");
0935:                        outFile.write("\n    <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0936:                        outFile.write("\n       <AttributeValuePair>");
0937:                        outFile.write("\n           <Attribute name=\"iplanet-srap-netfile-debug-flag\"/>");
0938:                        outFile.write("\n        <Value>"+allAttrs[1]);
0939:                        outFile.write("</Value>");
0940:                        outFile.write("\n       </AttributeValuePair>");
0941:                        outFile.write("\n    </ModifyServiceTemplate>");
0942:                        outFile.write("\n</OrganizationRequests>");
0943:                    }
0944:                     */
0945:                    if (attrName.equalsIgnoreCase("iwtNetFile-OScharset-at")
0946:                            && allAttrs.length > 1
0947:                            && allAttrs[1].trim().length() > 0) {
0948:                        outFile.write("\n<OrganizationRequests DN=\"" + fqOrgDN
0949:                                + "\">");
0950:                        //outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole,"+fqOrgDN+"\">");
0951:                        outFile
0952:                                .write("\n    <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0953:                        outFile.write("\n       <AttributeValuePair>");
0954:                        outFile
0955:                                .write("\n           <Attribute name=\"sunPortalNetFileOSCharSet\"/>");
0956:                        outFile.write("\n        <Value>" + allAttrs[1]);
0957:                        outFile.write("</Value>");
0958:                        outFile.write("\n       </AttributeValuePair>");
0959:                        outFile.write("\n    </ModifyServiceTemplate>");
0960:                        outFile.write("\n</OrganizationRequests>");
0961:                        //outFile.write("\n </RoleRequests>");
0962:                    }
0963:                    if (attrName.equalsIgnoreCase("iwtNetFile-ntdomain-at")
0964:                            && allAttrs.length > 1
0965:                            && allAttrs[1].trim().length() > 0) {
0966:                        //outFile.write("\n<OrganizationRequests DN=\""+fqOrgDN+"\">");
0967:                        outFile.write("\n <OrganizationRequests DN=\""
0968:                                + fqOrgDN + "\">");
0969:                        outFile
0970:                                .write("\n    <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0971:                        outFile.write("\n       <AttributeValuePair>");
0972:                        outFile
0973:                                .write("\n           <Attribute name=\"sunPortalNetFileNTDomain\"/>");
0974:                        outFile.write("\n        <Value>" + allAttrs[1]);
0975:                        outFile.write("</Value>");
0976:                        outFile.write("\n       </AttributeValuePair>");
0977:                        outFile.write("\n    </ModifyServiceTemplate>");
0978:                        //outFile.write("\n</OrganizationRequests>");
0979:                        outFile.write("\n </OrganizationRequests>");
0980:                        isNtDomain = true;
0981:                    }
0982:                    //}
0983:                }
0984:                if (!isMaxSearchDir && maxSearchDir != null
0985:                        && maxSearchDir.trim().length() != 0) {
0986:                    outFile.write("\n <OrganizationRequests DN=\"" + fqOrgDN
0987:                            + "\">");
0988:                    outFile
0989:                            .write("\n   <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
0990:                    outFile.write("\n     <AttributeValuePair>");
0991:                    outFile
0992:                            .write("\n        <Attribute name=\"sunPortalNetFileMaxSearchDir\"/>");
0993:                    outFile.write("\n        <Value>" + maxSearchDir);
0994:                    outFile.write("</Value>");
0995:                    outFile.write("\n    </AttributeValuePair>");
0996:                    outFile.write("\n   </ModifyServiceTemplate>");
0997:                    outFile.write("\n </OrganizationRequests>");
0998:                }
0999:                if (!isTempDir && tempDir != null
1000:                        && tempDir.trim().length() != 0) {
1001:                    outFile.write("\n<OrganizationRequests DN=\"" + fqOrgDN
1002:                            + "\">");
1003:                    //outFile.write("\n <RoleRequests DN=\"cn=ContainerDefaultTemplateRole,"+fqOrgDN+"\">");
1004:                    outFile
1005:                            .write("\n    <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
1006:                    outFile.write("\n       <AttributeValuePair>");
1007:                    outFile
1008:                            .write("\n           <Attribute name=\"sunPortalNetFileTempDir\"/>");
1009:                    outFile.write("\n        <Value>" + tempDir);
1010:                    outFile.write("</Value>");
1011:                    outFile.write("\n       </AttributeValuePair>");
1012:                    outFile.write("\n    </ModifyServiceTemplate>");
1013:                    outFile.write("\n</OrganizationRequests>");
1014:                    //outFile.write("\n </RoleRequests>");
1015:                }
1016:                if (!isNtDomain && ntDomain != null
1017:                        && ntDomain.trim().length() != 0) {
1018:                    //outFile.write("\n<OrganizationRequests DN=\""+fqOrgDN+"\">");
1019:                    outFile.write("\n <OrganizationRequests DN=\"" + fqOrgDN
1020:                            + "\">");
1021:                    outFile
1022:                            .write("\n    <ModifyServiceTemplate serviceName=\"srapNetFileService\" schemaType=\"Dynamic\">");
1023:                    outFile.write("\n       <AttributeValuePair>");
1024:                    outFile
1025:                            .write("\n           <Attribute name=\"sunPortalNetFileNTDomain\"/>");
1026:                    outFile.write("\n        <Value>" + ntDomain);
1027:                    outFile.write("</Value>");
1028:                    outFile.write("\n       </AttributeValuePair>");
1029:                    outFile.write("\n    </ModifyServiceTemplate>");
1030:                    //outFile.write("\n</OrganizationRequests>");
1031:                    outFile.write("\n </OrganizationRequests>");
1032:                }
1033:
1034:                return;
1035:            }
1036:
1037:            static String getOrgName(String dn) {
1038:                String orgName = new String();
1039:
1040:                orgName = dn.substring(3, dn.indexOf(","));
1041:                return orgName;
1042:            }
1043:
1044:            static String ConstructDN(String roleFileName) {
1045:                String rolename;
1046:                String tmp;
1047:                String dnToRet;//The DN to be returned
1048:
1049:                // Given the relative path of the current file. This function constructs the DN of the required Role i.e SUbORganization..*
1050:
1051:                dnToRet = new String();
1052:                tmp = roleFileName;
1053:                while (tmp.indexOf("/") >= 0) {
1054:                    dnToRet += ",o=" + tmp.substring(tmp.lastIndexOf("/") + 1);
1055:                    tmp = tmp.substring(0, tmp.lastIndexOf("/"));
1056:                }
1057:
1058:                return dnToRet;
1059:            }
1060:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.