552 |
552 |
* @param ldapDN the LDAP distinguished name, e.g.
|
553 |
553 |
* "uid=dryad,o=LTER,dc=ecoinformatics,dc=org"
|
554 |
554 |
* @param ldapPwd the corresponding LDAP password string
|
|
555 |
*
|
|
556 |
* @return loginSuccess, true if login succeeded, else false
|
555 |
557 |
*/
|
556 |
|
private static void metacatLogin(String ldapDN, String ldapPwd) {
|
557 |
|
try {
|
558 |
|
logger.info("Logging in to Metacat: " + ldapDN);
|
559 |
|
String response = metacatClient.login(ldapDN, ldapPwd);
|
560 |
|
logger.info("Metacat login response: " + response);
|
561 |
|
}
|
562 |
|
catch (MetacatInaccessibleException e) {
|
563 |
|
logger.error("Metacat login failed." + e.getMessage());
|
564 |
|
}
|
565 |
|
catch (Exception e) {
|
566 |
|
logger.error("Metacat login failed." + e.getMessage());
|
567 |
|
}
|
|
558 |
private static boolean metacatLogin(String ldapDN, String ldapPwd) {
|
|
559 |
boolean loginSuccess = false;
|
|
560 |
|
|
561 |
try {
|
|
562 |
logger.info("Logging in to Metacat: " + ldapDN);
|
|
563 |
String response = metacatClient.login(ldapDN, ldapPwd);
|
|
564 |
logger.info("Metacat login response: " + response);
|
|
565 |
loginSuccess = true;
|
|
566 |
}
|
|
567 |
catch (MetacatInaccessibleException e) {
|
|
568 |
logger.error("Metacat login failed." + e.getMessage());
|
|
569 |
}
|
|
570 |
catch (Exception e) {
|
|
571 |
logger.error("Metacat login failed." + e.getMessage());
|
|
572 |
}
|
|
573 |
|
|
574 |
return loginSuccess;
|
568 |
575 |
}
|
569 |
576 |
|
570 |
577 |
|
... | ... | |
774 |
781 |
{
|
775 |
782 |
logger.info("Starting OAI-PMH Harvester.");
|
776 |
783 |
if ((dn != null) && (password != null)) {
|
777 |
|
metacatLogin(dn, password);
|
|
784 |
boolean loginSuccess = metacatLogin(dn, password);
|
|
785 |
|
|
786 |
// Terminate harvester execution if login failed
|
|
787 |
if (!loginSuccess) {
|
|
788 |
logger.warn("Terminating OAI-PMH Harvester execution due to login failure.");
|
|
789 |
return;
|
|
790 |
}
|
778 |
791 |
}
|
779 |
792 |
else {
|
780 |
793 |
logger.error("Distinguished name (-dn) and/or password (-password) " +
|
... | ... | |
818 |
831 |
}
|
819 |
832 |
|
820 |
833 |
metacatLogout();
|
821 |
|
logger.info("Shutting down OAI-PMH Harvester.");
|
|
834 |
logger.info("Harvest completed. Shutting down OAI-PMH Harvester.");
|
822 |
835 |
}
|
823 |
836 |
|
824 |
837 |
|
Bug 3835: Design and implement OAI-PMH compliant harvest subsystem. Develop harvester component of the OAI-PMH harvester/provider pair. * Terminate harvest if login failed. * Add runHarvester.sh shell script