Project

General

Profile

« Previous | Next » 

Revision 928

Added by Jing Tao almost 23 years ago

Please check it.

View differences:

src/edu/ucsb/nceas/metacat/AuthLdap.java
1043 1043
  public void run()
1044 1044
  {
1045 1045
    referralContext = null;
1046
		DirContext refDirContext=null;
1046 1047
    try
1047 1048
    {
1048 1049
      System.out.println("running thread....");
1050
			//Revise environment variable
1051
			env.put(Context.PROVIDER_URL, refExc.getReferralInfo());
1052
			env.put(Context.INITIAL_CONTEXT_FACTORY, 
1053
            "com.sun.jndi.ldap.LdapCtxFactory");
1054
    	env.put(Context.REFERRAL, "throw");
1055
			//Get a context object for referral in the new envriment
1049 1056
      rContext = refExc.getReferralContext(env);
1050
			System.out.println("Before handling referral povider_url: "+
1057
			System.out.println("After revsing env, referral povider_url: "+
1051 1058
			env.get(Context.PROVIDER_URL));
1052
      referralContext = handleReferral(env, rContext);
1053
			System.out.println("rContext.PROVIDER_URL: "+rContext.PROVIDER_URL);
1059
			//refExc.retryReferral();
1060
			System.out.println("Here is environment for rContext: ");
1061
			System.out.println(rContext.getEnvironment());
1062
			System.out.println("here is rContext full name:");
1063
			System.out.println(rContext.getNameInNamespace());
1064
			//Casting the context to dircontext and hopelly will create a
1065
			//autherntication exception if DN and password is incorrect
1066
			referralContext=rContext;
1067
			refDirContext=(DirContext)rContext;
1068
			System.out.println("Why?");
1069
			//refDirContext=new InitialDirContext(env);
1070
			refDirContext.close();
1071
			//referralContext = handleReferral(env, rContext);
1072
			//System.out.println("rContext.PROVIDER_URL: "+rContext.PROVIDER_URL);
1054 1073
			//Hashtable tempenv=rContext.getEnvironment();
1055 1074
			//If running the above line, we will get a java.long.NullPointerException
1056
			System.out.println("After handling refferal povider_url: "+
1057
			env.get(Context.PROVIDER_URL));
1058
      System.out.println("exiting thread...");
1075
			System.out.println("exiting thread...");
1059 1076
    }
1077
		//Jing Tao
1078
		catch(AuthenticationException ae)
1079
		{	
1080
			System.out.println("In referral authentication exception");
1081
			System.out.println("Error running referral handler thread: " + 
1082
                          ae.getMessage());
1083
      ae.printStackTrace();
1084
      referralContext = null;
1085
			
1086
		}
1087
		//Jing Tao
1088
		catch(NamingException ne)
1089
		{
1090
			System.out.println("Error running referral handler thread: " + 
1091
                          ne.getMessage());
1092
      ne.printStackTrace();
1093
      referralContext = null;		
1094
		}
1060 1095
    catch(Exception e)
1061 1096
    {
1062 1097
      System.out.println("Error running referral handler thread: " + 

Also available in: Unified diff