Search in sources :

Example 1 with WebdavFile

use of nl.uva.vlet.vfs.webdavfs.WebdavFile in project lobcder by skoulouzis.

the class VPDRI method upload.

// private void debug(String msg) {
// if (debug) {
// //            System.err.println(this.getClass().getName() + ": " + msg);
// log.debug(msg);
// }
// }
private void upload(PDRI source) throws VlException, IOException {
    VFile file = getVfsClient().createFile(vrl, true);
    try {
        if (file instanceof CloudFile) {
            CloudFile uFile = (CloudFile) file;
            VFile sourceFile = getVfsClient().openFile(new VRL(source.getURI()));
            uFile.uploadFrom(sourceFile);
        } else if (file instanceof WebdavFile) {
            WebdavFile wFile = (WebdavFile) file;
            VFile sourceFile = getVfsClient().openFile(new VRL(source.getURI()));
            wFile.uploadFrom(sourceFile);
        }
        reconnectAttemts = 0;
    } catch (Exception ex) {
        if (reconnectAttemts < Constants.RECONNECT_NTRY) {
            reconnect();
            upload(source);
        } else {
            throw ex;
        }
    } catch (Throwable ex) {
        if (reconnectAttemts < Constants.RECONNECT_NTRY) {
            reconnect();
            upload(source);
        } else {
            throw ex;
        }
    }
}
Also used : VRL(nl.uva.vlet.vrl.VRL) CloudFile(nl.uva.vlet.vfs.cloud.CloudFile) WebdavFile(nl.uva.vlet.vfs.webdavfs.WebdavFile) URISyntaxException(java.net.URISyntaxException) ResourceNotFoundException(nl.uva.vlet.exception.ResourceNotFoundException) IllegalBlockSizeException(javax.crypto.IllegalBlockSizeException) JAXBException(javax.xml.bind.JAXBException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) InvalidKeyException(java.security.InvalidKeyException) VlException(nl.uva.vlet.exception.VlException) VRLSyntaxException(nl.uva.vlet.exception.VRLSyntaxException) InvalidAlgorithmParameterException(java.security.InvalidAlgorithmParameterException) NoSuchPaddingException(javax.crypto.NoSuchPaddingException) CertificateException(java.security.cert.CertificateException) UnknownHostException(java.net.UnknownHostException) BadPaddingException(javax.crypto.BadPaddingException)

Aggregations

URISyntaxException (java.net.URISyntaxException)1 UnknownHostException (java.net.UnknownHostException)1 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)1 InvalidKeyException (java.security.InvalidKeyException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 CertificateException (java.security.cert.CertificateException)1 BadPaddingException (javax.crypto.BadPaddingException)1 IllegalBlockSizeException (javax.crypto.IllegalBlockSizeException)1 NoSuchPaddingException (javax.crypto.NoSuchPaddingException)1 JAXBException (javax.xml.bind.JAXBException)1 ResourceNotFoundException (nl.uva.vlet.exception.ResourceNotFoundException)1 VRLSyntaxException (nl.uva.vlet.exception.VRLSyntaxException)1 VlException (nl.uva.vlet.exception.VlException)1 CloudFile (nl.uva.vlet.vfs.cloud.CloudFile)1 WebdavFile (nl.uva.vlet.vfs.webdavfs.WebdavFile)1 VRL (nl.uva.vlet.vrl.VRL)1