use of nl.uva.vlet.exception.VlException in project lobcder by skoulouzis.
the class GridHelper method initGridProxy.
public static void initGridProxy(String vo, String password, VRSContext context, boolean destroyCert) throws Exception {
InitGlobalVFS();
if (context == null) {
context = new VFSClient().getVRSContext();
// context = VRS.getDefaultVRSContext();
}
GridProxy gridProxy = context.getGridProxy();
if (destroyCert) {
gridProxy.destroy();
gridProxy = null;
}
if (gridProxy == null || gridProxy.isValid() == false) {
// context.setProperty("grid.proxy.location", Constants.PROXY_FILE);
// context.setProperty("grid.certificate.location", Global.getUserHome() + "/.globus");
// context.setProperty("grid.proxy.lifetime", "100");
context.setProperty("grid.proxy.voName", vo);
gridProxy = context.getGridProxy();
// if (gridProxy.isValid() == false) {
gridProxy.setEnableVOMS(true);
gridProxy.setDefaultVOName(vo);
gridProxy.createWithPassword(password);
if (gridProxy.isValid() == false) {
throw new VlException("Created Proxy is not Valid!");
// }
}
}
if (!new File(Constants.PROXY_FILE).exists()) {
gridProxy.saveProxyTo(Constants.PROXY_FILE);
}
}
use of nl.uva.vlet.exception.VlException in project lobcder by skoulouzis.
the class CachePDRI method putData.
@Override
public void putData(InputStream data) throws IOException, FileNotFoundException {
// asyncPut.run();
if (!getEncrypted()) {
try {
setResourceContent(data);
} catch (VlException ex) {
throw new IOException(ex);
}
} else {
try {
OutputStream out = new FileOutputStream(file);
DesEncrypter encrypter = new DesEncrypter(getKeyInt());
encrypter.decrypt(getData(), out);
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | InvalidAlgorithmParameterException ex) {
throw new IOException(ex);
}
}
}
use of nl.uva.vlet.exception.VlException in project lobcder by skoulouzis.
the class GetTask method run.
@Override
public void run() {
double start = System.currentTimeMillis();
FileOutputStream out = null;
File f = null;
try {
f = new File("/tmp/deleteme" + this.hashCode());
// f.deleteOnExit();
out = new FileOutputStream(f);
CircularStreamBufferTransferer cBuff = new CircularStreamBufferTransferer((512 * 1024), cl.getFile(vrl).getInputStream(), out);
cBuff.startTransfer((long) -1);
double elapsed = System.currentTimeMillis() - start;
System.err.println("Speed: " + (f.length() / elapsed));
sleeTime = 5;
} catch (Exception ex) {
try {
//
if (reconnectAttemts < 10) {
sleeTime = sleeTime + 20;
System.err.println("Reconnecting: " + reconnectAttemts + " sleep: " + sleeTime);
Thread.sleep(sleeTime);
reconnect();
run();
} else {
// Logger.getLogger(TestDrivers.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (InterruptedException ex1) {
Logger.getLogger(GetTask.class.getName()).log(Level.SEVERE, null, ex1);
//
} catch (VlException ex1) {
Logger.getLogger(GetTask.class.getName()).log(Level.SEVERE, null, ex1);
}
} finally {
try {
out.close();
} catch (IOException ex) {
Logger.getLogger(TestDrivers.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
use of nl.uva.vlet.exception.VlException in project lobcder by skoulouzis.
the class TestDrivers method main.
public static void main(String[] args) {
try {
String propBasePath = "etc" + File.separator + "test.proprties";
Properties prop = getTestProperties(propBasePath);
vrl = prop.getProperty("driver.test.vrl", "sftp://localhost/" + System.getProperty("user.home") + "/tmp");
username = prop.getProperty("driver.test.username", System.getProperty("user.name"));
password = prop.getProperty("driver.test.password");
testURL = prop.getProperty("webdav.test.url");
TestDrivers t = new TestDrivers();
t.test();
} catch (InterruptedException ex) {
Logger.getLogger(TestDrivers.class.getName()).log(Level.SEVERE, null, ex);
} catch (VlException ex) {
Logger.getLogger(TestDrivers.class.getName()).log(Level.SEVERE, null, ex);
} catch (FileNotFoundException ex) {
Logger.getLogger(TestDrivers.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(TestDrivers.class.getName()).log(Level.SEVERE, null, ex);
} finally {
VRS.exit();
System.exit(0);
}
}
Aggregations