isENCRYPT1 = true;
} else if (credential != null && !isENCRYPT1) {
isGSI = true;
}
SRBAccount srb = null;
try {
if (isENCRYPT1) {
log.debug("Create SRBAccount using ENCRYPT1");
if (homeDir != null && mdasDomainName != null &&
defaultStorageResource != null && mcatZone != null) {
//
srb = new SRBAccount(host, port, username, password,
homeDir, mdasDomainName, defaultStorageResource, mcatZone);
} else if (homeDir != null && mdasDomainName != null &&
defaultStorageResource != null) {
//
srb = new SRBAccount(host, port, username, password,
homeDir, mdasDomainName, defaultStorageResource);
}
} else if (isGSI) {
if (homeDir != null && defaultStorageResource != null) {
log.debug("Create SRBAccount using GSI with homeDir and storageResource");
srb = new SRBAccount(host, port, credential, homeDir,
defaultStorageResource, SRBAccount.GSI_AUTH);
} else {
// uses special constructor that sets GSI_AUTH and
// implements a login procedure using the 'ticketuser' in
// order to get the users home directory
log.debug("Create SRBAccount using GSI ticket user");
srb = new SRBAccount(host, port, credential);
}
}
// fall back to using local MdasFiles (true by default).
if (srb == null && useLocalMdasFiles) {
log.debug("Create SRBAccount using local MDAS files");
// Load some stuff from ~/.srb/.MdasEnv and .MdasAuth files
// (use default location unless otherwise specified).
if (mdasUserInfoDirectory == null) {
srb = new SRBAccount();
} else {
srb = new SRBAccount(mdasUserInfoDirectory);
}
}
// if SRBAccount is still null, then throw sensible error.
if (srb == null){
// Cannot create SRBAccount with given data
throw new FileSystemException("vfs.provider.srb/connect.error", host);
}
// Always try to specify the default storage resource - this is required so that
// uploads are targeted to the correct default storage resource, otherwise, any
// srb storage resource may be used and that can cause firewall block
// (remeber, that the srb uses multiple storage resources).
//srb.setDefaultStorageResource("ral-ngs1");
if (defaultStorageResource != null) {
srb.setDefaultStorageResource(defaultStorageResource);
}
// return SRBAccount.
return srb;
} catch (Exception ex) {