Users.java :  » Portal » Open-Portal » migration » modules » ldap » Java Open Source

Java Open Source » Portal » Open Portal 
Open Portal » migration » modules » ldap » Users.java
package migration.modules.ldap;

import netscape.ldap.util.*;

import netscape.ldap.LDAPAttribute;
import netscape.ldap.LDAPAttributeSet;
import com.sun.identity.security.EncryptAction;
import java.security.AccessController;
import java.util.*;
import java.io.*;
import java.net.URLDecoder;

//import com.iplanet.portalserver.util.Password;
//import com.iplanet.services.util.Crypt;
public class Users extends Common {

  static final int FIRSTNAME=7;
  static final int LASTNAME=8;
  static final int UID=9;
  static final int PHONE_NUMBER=10;
  static final int PASSWORD=11;
  static final int CREATORSNAME=12;
  static final int CREATETIMESTAMP=13;
  static final int MODIFIERSNAME=14;
  static final int MODIFYTIMESTAMP=15;
  static final int OBJECTCLASS=16;
  static final int PARENT=17;
  static final int ROLE_AT=18;
  static final int EMAIL=19;
  static final int USERNAME=20;
  static final int CN=21;
  static final int PROFILE_TYPE=22;
  static final int PROFILE_ID=23;



  /* Netmail related properties...*/
  static final int NETMAIL_USER_SMTP_ID=31;
  static final int NETMAIL_USER_SMTP_SERVER=32;
  static final int NETMAIL_USER_IMAP_ID=33;
  static final int NETMAIL_USER_IMAP_PASSWD=34;
  static final int NETMAIL_USER_IMAP_SERVER=35;
  static final int NETMAIL_USER_DEFAULTMAILDOMAIN=36;
  static final int NETMAIL_ROOT_FOLDER=37;
  static final int NETMAIL_SENT_FOLDER=38;
  static final int NETMAIL_REPLY_WITHAUTHOR=39;
  static final int NETMAIL_REPLY_WITHBODY=40;
  static final int NETMAIL_REPLY_WITHDATE=41;
  static final int NETMAIL_INDENT_PREFIX=42;
  static final int NETMAIL_ADD_SIGNATURE=43;
  static final int NETMAIL_INITIAL_HDRS=44;
  static final int NETMAIL_INACTIVITY_INTERVAL=45;
  static final int NETMAIL_MAX_ATTACH_LEN=46;
  static final int NETMAIL_AUTOLOAD=47;
  static final int NETMAIL_AUTOSAVE=48;
  static final int NETMAIL_AUTOPURGE=49;
  static final int NETMAIL_AUTOFOLDERLOAD=50;
  static final int NETMAIL_MULTIPLE_RDW=51;//Multiple Read Windows
  static final int NETMAIL_SORTKEY=52;
  static final int NETMAIL_VIEWKEY=53;
  static final int NETMAIL_COMPOSE_WINBOUNDS=54;
  static final int NETMAIL_FOLDER_WINBOUNDS=55;
  static final int NETMAIL_READ_WINBOUNDS=56;
  static final int NETMAIL_GRID_HEIGHT=57;
  static final int NETMAIL_GRID_COLWIDTHS=58;
  static final int NETMAIL_TEXT_COLOR=59;
  static final int NETMAIL_BGCOLOR=60;
  static final int NETMAIL_TEXTSIZE=61;
  static final int NETMAIL_TEXTSTYLE=62;
  static final int NETMAIL_HEADERS_PAGE=63;
  static final int NETMAIL_NEWEST_FIRST=64;
  static final int NETMAIL_LOGMSSGS=65;
  static final int NETMAIL_USER_REPLYTOADDRESS=66;
  static final int NETMAIL_SIGNATURE=67;
  static final int NETMAIL_CHAR_SET=68;
  static final int NETMAIL_PERSONAL_ADDRBOOK=69;
  static final int NETMAIL_EXEC_PV=70;
  static final int NETMAIL_EXEC_CAT=71;
  static final int NETMAIL_FAVORITE_FOLDER=72;

  static final int DESKTOP_PROVIDERS=73;
  static final int USER_LOCALE=74;
  static final int USER_AUTHMODULES=75;
  static final int USER_TIMEZONE=76;
  static final int USER_LOGINSTATE=77;

  static Map ATTRIBUTES = new HashMap();

  static String RoleValue=new String();
  static String currOrgName=new String();
  static String isFlat=new String("n");


  static OutputStreamWriter uidsToModify;//To handle the internal LDAP Server case
  static Map LISTOFORGS=new HashMap();
  static ArrayList adminRoles = new ArrayList();

        // authmap handles mapping of authentication handles to class names
        static AuthMap authmap = new AuthMap();

  public static void main(String args[]){

     String outputfile,ldiffile,rolefile;

     ldiffile   = new String();// Input file, the LDIF file to be converted....
     outputfile = new String();
     rolefile   = null;

   // arg[0] = exported user ldif file
   // arg[1] = converted user ldif file (outfile)
   // arg[2] = exorted role ldif file - used for delegated admin convert
   //
   if (args.length==3) {
      ldiffile   = args[0];
      outputfile = args[1];
      rolefile   = args[2];

      getAdminRoles(rolefile);
   }
     else if(args.length==2){
      outputfile=args[1];
      ldiffile=args[0];
     }
     else if(args.length==1){
      outputfile=new String("default.ldif");
      ldiffile=args[0];
     }
     else if(args.length==0){
      System.out.println("Input file to be converted not specified!");
      System.out.println("Invokation Format is:java UsersConvert infile outfile");
      System.exit(1);
     }
     doConvert(ldiffile,outputfile);
  }

    public static void doConvertWithDelegatedAdmin(String ldiffile,
               String outputfile,
               String rolefile) {
  getAdminRoles(rolefile);
  doConvert(ldiffile, outputfile);
    }

  public static void doConvert(String ldiffile,String outputfile){
     LDIFRecord out;
     OutputStreamWriter outFile;
     int count=0;
     LDIF l1;


     try{
      InitHashMap();  // Populate the hash map.
      String LDIFDIR=System.getProperty("LDIFDIR");
      String OUTPUTDIR=System.getProperty("OUTPUTDIR");
      String localeString=null;


      PopulateOrgsMap(OUTPUTDIR);
      File userDN = new File (LDIFDIR+"/userDNs.ldif");
      if (! userDN.exists()){
        userDN.createNewFile();
      }
      uidsToModify = new OutputStreamWriter(new FileOutputStream(userDN), "UTF-8");
      DataInputStream ldifFile = new DataInputStream(new FileInputStream(ldiffile));
      l1=new LDIF(ldifFile);
      outFile=new OutputStreamWriter(new FileOutputStream(outputfile), "UTF-8");;

      //System.out.println("Converting LDIF entries corr. to users from file:"+ldiffile+".....\n");

      LDIFRecord tmp=l1.nextRecord();
      Locale locale = Locale.getDefault();
      if(System.getProperty("LOCALE_STRING") != null)
      localeString=System.getProperty("LOCALE_STRING");

      if(localeString == null) locale = Locale.getDefault();
      else locale = getLocale(localeString);


      if(System.getProperty("FLAT") != null)
        isFlat=System.getProperty("FLAT");

      ResourceBundle ambundle;
      ambundle = ResourceBundle.getBundle("AMConfig",locale);

      if(ambundle.getObject("com.iplanet.am.rootsuffix") != null) rootsuffix=(String)(ambundle.getObject("com.iplanet.am.rootsuffix"));
      while(tmp !=null){

        //OutputRecord(tmp);

        RoleValue="";
        out=ConvertRecord(tmp,count);

        if (out != null) {
          count++;
          outFile.write("\n# Entry id:"+count+"\n");
          try{
            OutputRecord(outFile,out);
          }catch(Exception e){
            System.out.println("Error writing to output file:"+outputfile);
            e.printStackTrace();
          }
        }
        tmp=l1.nextRecord();
      }
      outFile.close();
      uidsToModify.close();
      System.out.println("\tprocessed "+count+" entries");
      //System.out.println("Output available in file "+outputfile);
     }catch(IOException e){
      System.out.println("Error:"+e.toString());
      e.printStackTrace();
     }
  }

  static void PopulateOrgsMap(String outDir){
    try{
      InputStreamReader fr=new InputStreamReader(new FileInputStream(outDir+"/.orgslist"), "UTF-8");
      BufferedReader buffRead= new BufferedReader(fr);
      String currLine;
      int i=0;
      while((currLine=buffRead.readLine()) != null){
        currLine=(currLine.trim()).toLowerCase();
        LISTOFORGS.put(currLine,new Integer(i));
        i++;
      }
      fr.close();
    }
    catch(IOException fnfe){
      return;
    }
  }
  static void InitHashMap(){
    /* Populate hash map to have the list of attributest that need to be processed....
    Attributes in the display profile stored in LDAP are not put in Hash Table.
    They are handled differently....*/

    ATTRIBUTES.put((new String("iwtAuthMembership-phoneNumber-at")).toLowerCase(), new Integer(PHONE_NUMBER));
    ATTRIBUTES.put((new String("iwtAuthMembership-password-at")).toLowerCase(), new Integer(PASSWORD));
    ATTRIBUTES.put((new String("iwtAuthMembership-email-at")).toLowerCase(), new Integer(EMAIL));
    ATTRIBUTES.put((new String("iwtAuthMembership-userName-at")).toLowerCase(), new Integer(USERNAME));
    ATTRIBUTES.put((new String("iwtUserInfoProvider-firstName-at")).toLowerCase(), new Integer(FIRSTNAME));
    ATTRIBUTES.put((new String("iwtUserInfoProvider-lastName-at")).toLowerCase(), new Integer(LASTNAME));
    ATTRIBUTES.put((new String("uid")).toLowerCase(), new Integer(UID));
    ATTRIBUTES.put((new String("creatorsname")).toLowerCase(), new Integer(CREATORSNAME));
    ATTRIBUTES.put((new String("createtimestamp")).toLowerCase(), new Integer(CREATETIMESTAMP));
    ATTRIBUTES.put((new String("modifiersname")).toLowerCase(), new Integer(MODIFIERSNAME));
    ATTRIBUTES.put((new String("modifytimestamp")).toLowerCase(), new Integer(MODIFYTIMESTAMP));
    ATTRIBUTES.put((new String("parent")).toLowerCase(), new Integer(PARENT));
    ATTRIBUTES.put((new String("iwtUser-role-at")).toLowerCase(), new Integer(ROLE_AT));
    ATTRIBUTES.put((new String("objectclass")).toLowerCase(), new Integer(OBJECTCLASS));
    ATTRIBUTES.put((new String("cn")).toLowerCase(), new Integer(CN));
    ATTRIBUTES.put((new String("profileid")).toLowerCase(), new Integer(PROFILE_ID));
    ATTRIBUTES.put((new String("profiletype")).toLowerCase(), new Integer(PROFILE_TYPE));



    ATTRIBUTES.put((new String("iwtUser-locale-at")).toLowerCase(), new Integer(USER_LOCALE));
    ATTRIBUTES.put((new String("iwtUser-authModules-at")).toLowerCase(), new Integer(USER_AUTHMODULES));
    ATTRIBUTES.put((new String("iwtUser-SMTPServerName-at")).toLowerCase(), new Integer(NETMAIL_USER_SMTP_SERVER));
    ATTRIBUTES.put((new String("iwtUser-IMAPServerName-at")).toLowerCase(), new Integer(NETMAIL_USER_IMAP_SERVER));
    ATTRIBUTES.put((new String("iwtUser-IMAPUserId-at")).toLowerCase(), new Integer(NETMAIL_USER_IMAP_ID));
    ATTRIBUTES.put((new String("iwtUser-IMAPPassword-at")).toLowerCase(), new Integer(NETMAIL_USER_IMAP_PASSWD));
    ATTRIBUTES.put((new String("iwtUser-defaultMailDomain-at")).toLowerCase(), new Integer(NETMAIL_USER_DEFAULTMAILDOMAIN));
    ATTRIBUTES.put((new String("iwtUser-replyToAddress-at")).toLowerCase(), new Integer(NETMAIL_USER_REPLYTOADDRESS));
    ATTRIBUTES.put((new String("iwtNetMail-rootFolder-at")).toLowerCase(), new Integer(NETMAIL_ROOT_FOLDER));
    ATTRIBUTES.put((new String("iwtNetMail-sentMessagesFolder-at")).toLowerCase(), new Integer(NETMAIL_SENT_FOLDER));
    ATTRIBUTES.put((new String("iwtNetMail-replyWithAuthor-at")).toLowerCase(), new Integer(NETMAIL_REPLY_WITHAUTHOR));
    ATTRIBUTES.put((new String("iwtNetMail-replyWithDate-at")).toLowerCase(), new Integer(NETMAIL_REPLY_WITHDATE));
    ATTRIBUTES.put((new String("iwtNetMail-replyWithBody-at")).toLowerCase(), new Integer(NETMAIL_REPLY_WITHBODY));
    ATTRIBUTES.put((new String("iwtNetMail-indentPrefix-at")).toLowerCase(), new Integer(NETMAIL_INDENT_PREFIX));
    ATTRIBUTES.put((new String("iwtNetMail-addSignature-at")).toLowerCase(), new Integer(NETMAIL_ADD_SIGNATURE));
    ATTRIBUTES.put((new String("iwtNetMail-initialHeaders-at")).toLowerCase(), new Integer(NETMAIL_INITIAL_HDRS));
    ATTRIBUTES.put((new String("iwtNetMail-inactivityInterval-at")).toLowerCase(), new Integer(NETMAIL_INACTIVITY_INTERVAL));
    ATTRIBUTES.put((new String("iwtNetMail-maxAttachLen-at")).toLowerCase(), new Integer(NETMAIL_MAX_ATTACH_LEN));
    ATTRIBUTES.put((new String("iwtNetMail-autoload-at")).toLowerCase(), new Integer(NETMAIL_AUTOLOAD));
    ATTRIBUTES.put((new String("iwtNetMail-autosave-at")).toLowerCase(), new Integer(NETMAIL_AUTOSAVE));
    ATTRIBUTES.put((new String("iwtNetMail-autopurge-at")).toLowerCase(), new Integer(NETMAIL_AUTOPURGE));
    ATTRIBUTES.put((new String("iwtNetMail-autoFolderload-at")).toLowerCase(), new Integer(NETMAIL_AUTOFOLDERLOAD));
    ATTRIBUTES.put((new String("iwtNetMail-multipleReadWindows-at")).toLowerCase(), new Integer(NETMAIL_MULTIPLE_RDW));
    ATTRIBUTES.put((new String("iwtNetMail-sortKey-at")).toLowerCase(), new Integer(NETMAIL_SORTKEY));
    ATTRIBUTES.put((new String("iwtNetMail-viewKey-at")).toLowerCase(), new Integer(NETMAIL_VIEWKEY));
    ATTRIBUTES.put((new String("iwtNetMail-composeWinBounds-at")).toLowerCase(), new Integer(NETMAIL_COMPOSE_WINBOUNDS));
    ATTRIBUTES.put((new String("iwtNetMail-folderWinBounds-at")).toLowerCase(), new Integer(NETMAIL_FOLDER_WINBOUNDS));
    ATTRIBUTES.put((new String("iwtNetMail-readWinBounds-at")).toLowerCase(), new Integer(NETMAIL_READ_WINBOUNDS));
    ATTRIBUTES.put((new String("iwtNetMail-gridHeight-at")).toLowerCase(), new Integer(NETMAIL_GRID_HEIGHT));
    ATTRIBUTES.put((new String("iwtNetMail-gridColWidths-at")).toLowerCase(), new Integer(NETMAIL_GRID_COLWIDTHS));
    ATTRIBUTES.put((new String("iwtNetMail-textColor-at")).toLowerCase(), new Integer(NETMAIL_TEXT_COLOR));
    ATTRIBUTES.put((new String("iwtNetMail-textSize-at")).toLowerCase(), new Integer(NETMAIL_TEXTSIZE));
    ATTRIBUTES.put((new String("iwtNetMail-backgroundColor-at")).toLowerCase(), new Integer(NETMAIL_BGCOLOR));
    ATTRIBUTES.put((new String("iwtNetMail-textStyle-at")).toLowerCase(), new Integer(NETMAIL_TEXTSTYLE));
    ATTRIBUTES.put((new String("iwtNetMail-headersPerPage-at")).toLowerCase(), new Integer(NETMAIL_HEADERS_PAGE));
    ATTRIBUTES.put((new String("iwtNetMail-newestFirst-at")).toLowerCase(), new Integer(NETMAIL_NEWEST_FIRST));
    ATTRIBUTES.put((new String("iwtNetMail-logMessages-at")).toLowerCase(), new Integer(NETMAIL_LOGMSSGS));
    ATTRIBUTES.put((new String("iwtNetMail-signature-at")).toLowerCase(), new Integer(NETMAIL_SIGNATURE));
    ATTRIBUTES.put((new String("iwtNetMail-charset-at")).toLowerCase(),new Integer(NETMAIL_CHAR_SET));
    ATTRIBUTES.put((new String("iwtNetMail-personaladdressbook-at")).toLowerCase(),new Integer(NETMAIL_PERSONAL_ADDRBOOK));
    ATTRIBUTES.put((new String("iwtNetMail-execute-pv-ac-")).toLowerCase(),new Integer(NETMAIL_EXEC_PV));
    ATTRIBUTES.put((new String("iwtNetMail-execute-pv-cat-")).toLowerCase(),new Integer(NETMAIL_EXEC_CAT));
    ATTRIBUTES.put((new String("iwtNetMail-favoriteFolders-at")).toLowerCase(),new Integer(NETMAIL_FAVORITE_FOLDER));

    ATTRIBUTES.put((new String("iwtDesktop-userSelectedProviders-at")).toLowerCase(),new Integer(DESKTOP_PROVIDERS));
    ATTRIBUTES.put((new String("iwtUser-timezone-at")).toLowerCase(),new Integer(USER_TIMEZONE));
    ATTRIBUTES.put((new String("iwtUser-loginState-at")).toLowerCase(),new Integer(USER_LOGINSTATE));
  }
  static LDIFRecord ConvertRecord(LDIFRecord toConvert,int count){
    LDIFAttributeContent con,converted;
    LDAPAttribute tmp;
    LDAPAttributeSet theAttrSet;
    String attrVal,firstname;
    String[] allAttrs;
    String[] listAllAttrs;
    String[] allAttrsConv;
    Vector dispProf=new Vector();
    String lastname=new String();
    boolean cnValuetobeSet=false;
    String dn;
    firstname=new String();
    //DispProfile dp;

    MimeBase64Decoder MBD=new MimeBase64Decoder();
    ByteBuf tmpBuf;
    /* NOTE: CHECK WITH HARRY, BEFORE ACTUALLY INCLUDING THIS......GET TO KNOW THE INTERFACE.....CHECK IF WHAT
      YOU DID IS CORRECT AND THEN INCLUDE......??? */


    LDAPAttribute[] attrList;
    int i,typeAttr;


    con=(LDIFAttributeContent)toConvert.getContent();
    converted=new LDIFAttributeContent();
    attrList=con.getAttributes();
    theAttrSet = new LDAPAttributeSet(attrList);

  // Filter uids 'authentication' and starting with 'gateway-'
  // per 3.x admin console code
  //
  String uid = ((String [])theAttrSet.getAttribute("uid").getStringValueArray())[0];

  if (uid != null) {
    if ((uid.equals("authentication")) || (uid.startsWith("gateway-"))) {
      return null;
    }
  }

    converted.setControls(con.getControls());

    for(i=0;i<attrList.length;++i){
      typeAttr=attrType(attrList[i].getName());
      switch(typeAttr){

        case -1:
          break;

        case PHONE_NUMBER:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("telephoneNumber",attrVal));
          break;
        case PASSWORD:

          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          tmpBuf=new ByteBuf("");
          MBD.translate(new ByteBuf(attrVal),tmpBuf);
          attrVal=tmpBuf.toString();
          //attrVal=Password.decrypt(attrVal);
          //fwp.write(attrVal);
          //attrVal=Crypt.encrypt(attrVal);
          //System.out.println("Encrypted...."+attrVal);
          converted.addElement(new LDAPAttribute("userPassword",attrVal));
          break;

        case EMAIL :
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("mail",attrVal));
          break;

        case FIRSTNAME:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1]; firstname=attrVal;cnValuetobeSet=true;
          converted.addElement(new LDAPAttribute("givenName",attrVal));
          break;

        case LASTNAME:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];lastname=attrVal;cnValuetobeSet=false;
          converted.addElement(new LDAPAttribute("sn",attrVal));
          break;

        case USERNAME:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          //converted.addElement(new LDAPAttribute("cn",attrVal));
          break;


        case UID:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[0];
          converted.addElement(new LDAPAttribute("uid",attrVal));
          break;

        case CREATORSNAME:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[0];
          converted.addElement(new LDAPAttribute("creatorsName",attrVal));
          break;

        case CREATETIMESTAMP:

          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[0];
          converted.addElement(new LDAPAttribute("createTimestamp",attrVal));
          break;
        case MODIFIERSNAME:

          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[0];
          converted.addElement(new LDAPAttribute("modifiersName",attrVal));
          break;
        case MODIFYTIMESTAMP:

          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[0];
          converted.addElement(new LDAPAttribute("modifyTimeStamp",attrVal));
          break;
        case OBJECTCLASS:
          converted.addElement(new LDAPAttribute("objectclass","sunPortalNetmailPerson"));
          converted.addElement(new LDAPAttribute("objectclass","sunPortalDesktopPerson"));
          converted.addElement(new LDAPAttribute("objectclass","iplanet-am-web-agent-service"));
          converted.addElement(new LDAPAttribute("objectclass","inetuser"));
          converted.addElement(new LDAPAttribute("objectclass","iplanet-am-managed-person"));
          converted.addElement(new LDAPAttribute("objectclass","top"));
          converted.addElement(new LDAPAttribute("objectclass","person"));
          converted.addElement(new LDAPAttribute("objectclass","organizationalPerson"));
          converted.addElement(new LDAPAttribute("objectclass","iPlanetPreferences"));
          converted.addElement(new LDAPAttribute("objectclass","inetOrgPerson"));
          converted.addElement(new LDAPAttribute("objectclass","iplanet-am-user-service"));
          break;

        case ROLE_AT:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          RoleValue=allAttrs[1];

          if (adminRoles.contains(allAttrs[1])) {
      String orgName  = allAttrs[1].substring(1, allAttrs[1].indexOf("/",1));
      String orgAdmin = constructRoleDN("Organization Admin Role", orgName, rootsuffix);
              converted.addElement(new LDAPAttribute("nsRoleDN", orgAdmin));
          }

          if(isFlat.equalsIgnoreCase("y")){
            allAttrsConv=getnsRoleDN(allAttrs[1]);
            converted.addElement(new LDAPAttribute("nsRoleDN",allAttrsConv));
          }
          break;

        case PARENT:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          currOrgName=(allAttrs[0].trim()).substring(1);
          //attrVal=getMemberOfVal(allAttrs[0]);
          /* Member-of element in Hana only appears when there is people-groups.....Doesnot have equiv. in
          iPS3.0.....So can ignore */
          // converted.addElement(new LDAPAttribute("memberOf",attrVal));
          break;

        case NETMAIL_USER_IMAP_ID:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailIMAPUserid",attrVal));
          break;

        case NETMAIL_USER_IMAP_PASSWD:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          tmpBuf=new ByteBuf("");
          MBD.translate(new ByteBuf(attrVal),tmpBuf);
          attrVal=tmpBuf.toString();
          //attrVal=Password.decrypt(attrVal);
          //fwp.write(attrVal);
          //attrVal=Crypt.encrypt(attrVal);
          //System.out.println("Encrypted...."+attrVal);
          //converted.addElement(new LDAPAttribute("userPassword",attrVal));
          String convertedPwd = (String) AccessController.doPrivileged(new EncryptAction(attrVal));
          converted.addElement(new LDAPAttribute("sunPortalNetmailIMAPPassword",convertedPwd));
          break;

        case NETMAIL_USER_SMTP_SERVER:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailSMTPServerName",attrVal));
          break;

        case NETMAIL_USER_IMAP_SERVER:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailIMAPServerName",attrVal));
          break;


        case NETMAIL_USER_DEFAULTMAILDOMAIN:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailDefaultMailDomain",attrVal));
          break;

        case NETMAIL_ROOT_FOLDER:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailRootFolder",attrVal));
          break;

        case NETMAIL_SENT_FOLDER:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailSentMessagesFolder",attrVal));
          break;

        case NETMAIL_REPLY_WITHAUTHOR:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailReplyWithAuthor",attrVal));
          break;

        case NETMAIL_REPLY_WITHDATE:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailReplyWithDate",attrVal));
          break;

        case NETMAIL_REPLY_WITHBODY:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailReplyWithBody",attrVal));
          break;

        case NETMAIL_INDENT_PREFIX:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailIndentPrefix",attrVal));
          break;

        case NETMAIL_ADD_SIGNATURE:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailAddSignature",attrVal));
          break;

        case NETMAIL_INITIAL_HDRS:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailInitialHeaders",attrVal));
          break;

        case NETMAIL_INACTIVITY_INTERVAL:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailInactivityInterval",attrVal));
          break;

        case NETMAIL_MAX_ATTACH_LEN:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailMaxAttachLen",attrVal));
          break;

        case NETMAIL_AUTOLOAD:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailAutoload",attrVal));
          break;

        case NETMAIL_AUTOSAVE:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailAutosave",attrVal));
          break;

        case NETMAIL_AUTOPURGE:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailAutopurge",attrVal));
          break;

        case NETMAIL_AUTOFOLDERLOAD:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailAutoFolderLoad",attrVal));
          break;

        case NETMAIL_MULTIPLE_RDW:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailMultipleReadWindows",attrVal));
          break;

        case NETMAIL_SORTKEY:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailSortKey",attrVal));
          break;

        case NETMAIL_VIEWKEY:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailViewKey",attrVal));
          break;
        case NETMAIL_COMPOSE_WINBOUNDS:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailComposeWinBounds",attrVal));
          break;

        case NETMAIL_FOLDER_WINBOUNDS:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailFolderWinBounds",attrVal));
          break;

        case NETMAIL_READ_WINBOUNDS:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailReadWinBounds",attrVal));
          break;

        case NETMAIL_GRID_HEIGHT:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailGridHeight",attrVal));
          break;

        case NETMAIL_GRID_COLWIDTHS:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          try{
            attrVal=URLDecoder.decode(allAttrs[1]);
            converted.addElement(new LDAPAttribute("sunPortalNetmailGridColWidths",attrVal));
          }
          catch(Exception e){

          }

          break;

        case NETMAIL_TEXT_COLOR:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailTextColor",attrVal));
          break;

        case NETMAIL_BGCOLOR:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailBackgroundColor",attrVal));
          break;

        case NETMAIL_TEXTSIZE:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailTextSize",attrVal));
          break;

        case NETMAIL_TEXTSTYLE:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailTextStyle",attrVal));
          break;

        case NETMAIL_HEADERS_PAGE:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailHeadersPerPage",attrVal));
          break;

        case NETMAIL_NEWEST_FIRST:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailNewestFirst",attrVal));
          break;

        case NETMAIL_LOGMSSGS:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailLogMessages",attrVal));
          break;

        case NETMAIL_USER_REPLYTOADDRESS:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("sunPortalNetmailReplyToAddress",attrVal));
          break;

        case NETMAIL_SIGNATURE:

          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          tmpBuf=new ByteBuf("");
          MBD.translate(new ByteBuf(attrVal),tmpBuf);
          attrVal=processNLines(tmpBuf.toString());

          converted.addElement(new LDAPAttribute("sunPortalNetmailSignature",attrVal));
          break;
        case NETMAIL_CHAR_SET: break;
        case NETMAIL_PERSONAL_ADDRBOOK:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          if(allAttrs.length > 2){
            int k=0;

            /* In 6.x, each nickname, mailids is stored as pair of
              nickname,mailid@domain1, mailid@domain2

               In 3.0, it was stored as
              nickname
              mailid@domain1,mailid@domain2
            */
            listAllAttrs = new String[(allAttrs.length-1)/2];
            for(int jk=1;jk<allAttrs.length;jk=jk+2){
              listAllAttrs[k]=allAttrs[jk]+","+allAttrs[jk+1];
              k++;
            }
            converted.addElement(new LDAPAttribute("sunPortalNetmailPersonalAddressBook",listAllAttrs));
          }
          break;
        case NETMAIL_FAVORITE_FOLDER:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          if(allAttrs.length > 1){
            listAllAttrs = new String[allAttrs.length-1];
            for(int jk=1;jk<allAttrs.length;++jk)
              listAllAttrs[jk-1]=allAttrs[jk];
            converted.addElement(new LDAPAttribute("sunPortalNetmailFavoriteFolders",listAllAttrs));
          }
          break;

        case DESKTOP_PROVIDERS:
          boolean tabContainerFound=false;
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          if(allAttrs.length > 1){
            for(int jk=1;jk<allAttrs.length;++jk){
              if(allAttrs[jk].equalsIgnoreCase("iwtTabProvider")){
                tabContainerFound=true;
              }
            }
          }
          if(tabContainerFound==true)
            converted.addElement(new LDAPAttribute("sunPortalDesktopDefaultChannelName","TemplateTabContainer"));
          else
            converted.addElement(new LDAPAttribute("sunPortalDesktopDefaultChannelName","TemplateTableContainer"));
          break;
        case USER_LOCALE:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("preferredLocale",attrVal));
          converted.addElement(new LDAPAttribute("preferredlanguage",getLanguage(attrVal)));
          break;

        case USER_AUTHMODULES:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          if(allAttrs.length > 1){
            StringBuffer authModuleList = new StringBuffer();
                                                boolean authModuleListHasValue=false;
                                                authModuleList.append("<AttributeValuePair>");
            for(int jk=1;jk<allAttrs.length;++jk) {
                                                  if (authmap.containsKeyIgnoreCase(allAttrs[jk])){
                                                    authModuleList.append("<Value>");
                authModuleList.append((String)authmap.getIgnoreCase(allAttrs[jk]));
                                                    authModuleList.append(" REQUIRED </Value>");
                                                    authModuleListHasValue=true;
                                                  }   
            }
            authModuleList.append("</AttributeValuePair>");
                                                if (authModuleListHasValue) {
                                                  converted.addElement(new LDAPAttribute("iplanet-am-user-auth-config",authModuleList.toString()));
            }
          }
          break;

        case USER_TIMEZONE:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          converted.addElement(new LDAPAttribute("preferredtimezone",attrVal));

          break;
        case USER_LOGINSTATE:
          allAttrs=(((LDAPAttribute)(theAttrSet.getAttribute(attrList[i].getName()))).getStringValueArray());
          attrVal=allAttrs[1];
          if(!attrVal.equalsIgnoreCase("disabled"))
            converted.addElement(new LDAPAttribute("inetUserStatus","Active"));
          else
            converted.addElement(new LDAPAttribute("inetUserStatus","Inactive"));

          break;
        case CN: break;
        case PROFILE_ID: break;
        case PROFILE_TYPE: break;
      }
    }
    //System.out.println("Disp Prof:"+dispProf.toString());

    if(cnValuetobeSet == true)
      converted.addElement(new LDAPAttribute("cn",firstname+" "+lastname));
    if(dispProf.size() != 0){
    //  dp=new DispProfile(dispProf);

    //  converted.addElement(new LDAPAttribute("sunPortalDesktopDpDocumentUser",dp.getDP()));
    }
    return new LDIFRecord(toConvert.getDN(),converted);
  }

  static String processNLines(String inName){

    String toRet;
    int index,tmp;

    index=inName.indexOf("\n");
    if(index < 0) return inName;
    toRet=inName.substring(0,index);
    while(index >= 0 && index < inName.length()){
      tmp=inName.indexOf("\n",index+1);
      if(tmp != -1)
        toRet += "\n "+inName.substring(index+1,tmp);
      else
        toRet += "\n "+inName.substring(index+1);
      index=tmp;
    }

    return toRet;

  }
  static int attrType(String attrName){
    /* Returns the type of attribute that is being handled currently....*/

    try{
      return ((Integer)ATTRIBUTES.get(attrName.toLowerCase())).intValue();
    }
    catch(Exception e){
      return -1;
    }


  }
  static int OrgPresent(String attrName){

    try{
      return ((Integer)LISTOFORGS.get(attrName.toLowerCase())).intValue();
    }
    catch(Exception e){
      return -1;
    }


  }

  /*static String getMemberOfVal(String parent){
    String toRet=new String("

  } */
  static String[] getnsRoleDN(String role){

    String orgName=new String();
    String roleTemp=new String();
    String temp;
    int j=0;
    int count=0;

    orgName=role.substring(1,role.indexOf("/",1));

    if(role.indexOf("/",1) >=0)
      role=role.substring(role.indexOf("/",1));

    StringTokenizer strTok     = new StringTokenizer(role,"/");
    String []       rolesList  = new String[strTok.countTokens()];
    String          concatRole = "";

    while(strTok.hasMoreTokens()){
      concatRole += "_" + strTok.nextToken();

      if (concatRole.startsWith("_")) {
    concatRole = concatRole.substring(1, concatRole.length());
      }

      temp = constructRoleDN(concatRole, orgName, rootsuffix);
      rolesList[j] = new String(temp);
      //System.out.println("RolesList.."+rolesList[j]);
      j++;
    }

    return rolesList;

  }
  static void OutputRecord(OutputStreamWriter fw,LDIFRecord  toOutput) throws Exception{
    LDIFAttributeContent con;
    LDAPAttribute[] list;
    LDAPAttributeSet theAttrSet;
    String [] values;
    String dnVal=new String();
    String uid=new String();
    boolean snExists=false;
    boolean cnExists=false;
    boolean userPasswordPresent=false;

    con=(LDIFAttributeContent)toOutput.getContent();
    list=con.getAttributes();
    theAttrSet=new LDAPAttributeSet(list);
    //System.out.println("\ndn:"+toOutput.getDN());


    if(isFlat.equalsIgnoreCase("y"))
      dnVal=getDN(toOutput.getDN());
    else
      dnVal=processDN(toOutput.getDN());
    fw.write("\ndn:"+dnVal);
    for(int i=0;i<theAttrSet.size();++i){
      values=(String [])(theAttrSet.elementAt(i)).getStringValueArray();
      for(int j=0;j<values.length;++j){
        /* System.out.print((theAttrSet.elementAt(i)).getName());
        System.out.println(":"+values[j]+"  ");  */
        fw.write("\n"+(theAttrSet.elementAt(i)).getName());
        fw.write(":"+values[j]);
      }
      if(((theAttrSet.elementAt(i)).getName()).equals("cn")) cnExists=true;
      if(((theAttrSet.elementAt(i)).getName()).equals("sn")) snExists=true;
      if(((theAttrSet.elementAt(i)).getName()).equals("uid")) uid=values[0];
      if(((theAttrSet.elementAt(i)).getName()).equals("userPassword")) userPasswordPresent=true;
    }

    // if(cnExists != true) fw.write("\ncn: default");
    if(cnExists != true) fw.write("\ncn: "+uid);
    if(snExists != true) fw.write("\nsn: default");
    fw.write("\n");
    if(!userPasswordPresent){
       if(OrgPresent(currOrgName.toLowerCase()) != -1 && dnVal.length()>1){
          //LdapInternalServer() present...
        uidsToModify.write(dnVal+"\n");
       }
    }
    return;
  }
  static String getDN(String inDN){
    String toRet=new String("uid=");

    toRet = toRet+inDN.substring(inDN.indexOf("=")+1,inDN.indexOf(","))+",ou=People," + orgNaming + currOrgName;
    toRet = toRet+","+rootsuffix;

    return toRet;
  }
  static String processDN(String inDN){
    String toRet=new String("uid=");
    String tmp;

    inDN=inDN.trim();
    toRet = toRet+inDN.substring(inDN.indexOf("=")+1,inDN.indexOf(","))+",ou=People";
    if(RoleValue.equals("")){
      //System.out.println("Returning DN:"+toRet);
    }
    else{
      //System.out.println("RoleValue.."+RoleValue);
      tmp=RoleValue;
      while(tmp.indexOf("/")>= 0){
        toRet += "," + orgNaming + tmp.substring(tmp.lastIndexOf("/")+1);
        tmp=tmp.substring(0,tmp.lastIndexOf("/"));
      }

    }
    toRet = toRet+","+rootsuffix;
    return toRet;
  }
  static void DispContent(LDIFAttributeContent l){
    LDAPAttribute[] list;
    LDAPAttributeSet theAttrSet;

    System.out.println("*******DISPLAY**********");
    list=l.getAttributes();
    theAttrSet=new LDAPAttributeSet(list);
    for(int i=0;i<theAttrSet.size();++i)
      System.out.println("Attribute name:"+(theAttrSet.elementAt(i)).getName());

  }
 static java.util.Locale getLocale(String stringformat) {
  if (stringformat == null)
      return java.util.Locale.getDefault();

  StringTokenizer tk = new StringTokenizer(stringformat,"_");
  String lang = "";
  String country = "";
  String variant = "";

  if (tk.hasMoreTokens())
      lang = tk.nextToken();
  if (tk.hasMoreTokens())
      country = tk.nextToken();
  if (tk.hasMoreTokens())
      variant = tk.nextToken();

  return new java.util.Locale(lang,country,variant);
    }


 static String getLanguage(String stringLocale){

  StringTokenizer tk = new StringTokenizer(stringLocale,"_");
  String lang = "";

  if (tk.hasMoreTokens())
      lang = tk.nextToken();

  return lang;
 }


    /*
     * Responsible for retrieving Admin Roles from exported role ldif and
     * populating the AdminRoles ArrayList.
     *
     * Logic:
     * - create LDIF based on $exportDir/ldif/role.ldif
     * - get privilege iwtAdmin-execute-pv-ac- if found and true then
     * - get attribute profileid
     * - store profile id in delegated admin role list (adminRoles)
     *
     * The profileid value is in the same form as the value of iwtUser-role
     *
     * @param rolefile String representing the role .ldif file
     */
    public static void getAdminRoles(String rolefile){
  LDIFRecord lrecord      = null;
  LDIF       ldif         = null;

  try {
      ldif = new LDIF(rolefile);

      while ((lrecord = ldif.nextRecord()) != null) {
    LDIFAttributeContent lattrContent = (LDIFAttributeContent)lrecord.getContent();
    LDAPAttributeSet     lattrSet     = new LDAPAttributeSet(lattrContent.getAttributes());

    if (lattrSet != null) {
        LDAPAttribute lattr = lattrSet.getAttribute("iwtAdmin-execute-pv-ac-");

        if ((lattr != null) &&
      (Boolean.valueOf(lattr.getStringValueArray()[0]).booleanValue())) {
      lattr = lattrSet.getAttribute("profileid");

      if (lattr != null) {
          adminRoles.add(lattr.getStringValueArray()[0]);
      }

        }
    }
      }

  } catch(IOException e){
      System.out.println("Error:" + e.toString());
      e.printStackTrace();
  }

    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.