Project

General

Profile

« Previous | Next » 

Revision 6152

placeholder for setting up certificate manager

View differences:

src/edu/ucsb/nceas/metacat/util/MetacatPopulator.java
44 44
import org.dataone.client.D1Client;
45 45
import org.dataone.client.MNode;
46 46
import org.dataone.client.ObjectFormatCache;
47
import org.dataone.client.auth.CertificateManager;
47 48
import org.dataone.service.types.AccessPolicy;
48 49
import org.dataone.service.types.AccessRule;
49 50
import org.dataone.service.types.Checksum;
......
75 76
    private String query = null;
76 77
    private String username = null;
77 78
    private String password = null;
79
    private Session session = null;
78 80
    
79 81
    /**
80 82
     * create a new MetacatPopulator with given source and destination urls.  
......
94 96
        this.username = username;
95 97
        this.password = password;
96 98
        this.destinationUrl = destUrl;
99
        // TODO: set up certificate for D1 interaction
100
        CertificateManager.getInstance();
101
        this.session = new Session();
102
        Subject subject = new Subject();
103
        subject.setValue(username);
97 104
    }
98 105
    
99 106
    /**
......
128 135
        
129 136
        printHeader("Processing " + docs.size() + " results.");
130 137
        printHeader("logging in to the destination " + destinationUrl);
131
        //AuthToken authtoken = mn.login(username, password);
132
        // TODO: get session
133
        Session session = null;
138
        
134 139
        System.out.println("session: " + session.getSubject());
135 140
        for(int i=0; i<docs.size(); i++)
136 141
        {
......
525 530
        return login(sourceUrl);
526 531
    }
527 532
    
528
    /**
529
     * login the destination
530
     * @return
531
     * @throws Exception
532
     */
533
    private String loginDest()
534
        throws Exception
535
    {
536
        return login(destinationUrl);
537
    }
538 533
    
539 534
    /**
540 535
     * returns a sessionid
......
544 539
      throws Exception
545 540
    {
546 541
        InputStream is = getResponse(sourceUrl, "/metacat", 
547
                "action=login&username=" + username + "&password=" + password + "&qformat=xml", 
548
        "POST");
542
                "action=login&username=" + username + "&password=" + password + "&qformat=xml", "POST");
549 543
        String response = streamToString(is);
550 544
        //System.out.println("response: " + response);
551 545
        if(response.indexOf("sessionId") == -1)

Also available in: Unified diff