Search in sources :

Example 6 with GuestOperationsFaultFaultMsg

use of com.vmware.vim25.GuestOperationsFaultFaultMsg in project mucommander by mucommander.

the class VSphereFile method changeDate.

@Override
public void changeDate(long lastModified) throws IOException, UnsupportedFileOperationException {
    VsphereConnHandler connHandler = null;
    try {
        GuestFileAttributes gfa = new GuestFileAttributes();
        gfa.setModificationTime(getTimeToXmlTime(lastModified));
        connHandler = getConnHandler();
        connHandler.getClient().getVimPort().changeFileAttributesInGuest(getFileManager(connHandler), vm, credentials, getPathInVm(), gfa);
    } catch (FileFaultFaultMsg e) {
        translateandLogException(e);
    } catch (GuestOperationsFaultFaultMsg e) {
        translateandLogException(e);
    } catch (InvalidStateFaultMsg e) {
        translateandLogException(e);
    } catch (RuntimeFaultFaultMsg e) {
        translateandLogException(e);
    } catch (TaskInProgressFaultMsg e) {
        translateandLogException(e);
    } catch (InvalidPropertyFaultMsg e) {
        translateandLogException(e);
    } catch (DatatypeConfigurationException e) {
        translateandLogException(e);
    } finally {
        releaseConnHandler(connHandler);
    }
}
Also used : InvalidStateFaultMsg(com.vmware.vim25.InvalidStateFaultMsg) DatatypeConfigurationException(javax.xml.datatype.DatatypeConfigurationException) TaskInProgressFaultMsg(com.vmware.vim25.TaskInProgressFaultMsg) GuestFileAttributes(com.vmware.vim25.GuestFileAttributes) InvalidPropertyFaultMsg(com.vmware.vim25.InvalidPropertyFaultMsg) FileFaultFaultMsg(com.vmware.vim25.FileFaultFaultMsg) GuestOperationsFaultFaultMsg(com.vmware.vim25.GuestOperationsFaultFaultMsg) RuntimeFaultFaultMsg(com.vmware.vim25.RuntimeFaultFaultMsg)

Example 7 with GuestOperationsFaultFaultMsg

use of com.vmware.vim25.GuestOperationsFaultFaultMsg in project mucommander by mucommander.

the class VSphereFile method checkAttributues.

private void checkAttributues(VsphereConnHandler connHandler) throws IOException, FileFaultFaultMsg, GuestOperationsFaultFaultMsg, InvalidStateFaultMsg, RuntimeFaultFaultMsg, TaskInProgressFaultMsg, InvalidPropertyFaultMsg {
    ManagedObjectReference fileManager = getFileManager(connHandler);
    GuestListFileInfo res = null;
    try {
        res = connHandler.getClient().getVimPort().listFilesInGuest(fileManager, vm, credentials, getPathInVm(), null, null, null);
    } catch (SOAPFaultException e) {
        if (isFileNotFound(e)) {
            return;
        }
        throw e;
    }
    if (res.getFiles().size() == 1) {
        // only one result - it's a file
        GuestFileInfo guestFileInfo = res.getFiles().get(0);
        updateAttributes(guestFileInfo);
    } else {
        // find the entry for "."
        for (GuestFileInfo f : res.getFiles()) {
            if (f.getPath().equals(".")) {
                updateAttributes(f);
                break;
            }
        }
    }
}
Also used : GuestListFileInfo(com.vmware.vim25.GuestListFileInfo) GuestFileInfo(com.vmware.vim25.GuestFileInfo) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Example 8 with GuestOperationsFaultFaultMsg

use of com.vmware.vim25.GuestOperationsFaultFaultMsg in project mucommander by mucommander.

the class VSphereFile method delete.

@Override
public void delete() throws IOException, UnsupportedFileOperationException {
    VsphereConnHandler connHandler = null;
    try {
        connHandler = getConnHandler();
        ManagedObjectReference fileManager = getFileManager(connHandler);
        if (isDirectory()) {
            connHandler.getClient().getVimPort().deleteDirectoryInGuest(fileManager, vm, credentials, getPathInVm(), false);
            isDir = false;
        } else {
            connHandler.getClient().getVimPort().deleteFileInGuest(fileManager, vm, credentials, getPathInVm());
            isFile = isSymLink = false;
        }
    } catch (FileFaultFaultMsg e) {
        translateandLogException(e);
    } catch (GuestOperationsFaultFaultMsg e) {
        translateandLogException(e);
    } catch (InvalidStateFaultMsg e) {
        translateandLogException(e);
    } catch (RuntimeFaultFaultMsg e) {
        translateandLogException(e);
    } catch (TaskInProgressFaultMsg e) {
        translateandLogException(e);
    } catch (InvalidPropertyFaultMsg e) {
        translateandLogException(e);
    } finally {
        releaseConnHandler(connHandler);
    }
}
Also used : InvalidStateFaultMsg(com.vmware.vim25.InvalidStateFaultMsg) TaskInProgressFaultMsg(com.vmware.vim25.TaskInProgressFaultMsg) InvalidPropertyFaultMsg(com.vmware.vim25.InvalidPropertyFaultMsg) FileFaultFaultMsg(com.vmware.vim25.FileFaultFaultMsg) GuestOperationsFaultFaultMsg(com.vmware.vim25.GuestOperationsFaultFaultMsg) RuntimeFaultFaultMsg(com.vmware.vim25.RuntimeFaultFaultMsg) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Aggregations

FileFaultFaultMsg (com.vmware.vim25.FileFaultFaultMsg)6 GuestOperationsFaultFaultMsg (com.vmware.vim25.GuestOperationsFaultFaultMsg)6 InvalidPropertyFaultMsg (com.vmware.vim25.InvalidPropertyFaultMsg)6 InvalidStateFaultMsg (com.vmware.vim25.InvalidStateFaultMsg)6 RuntimeFaultFaultMsg (com.vmware.vim25.RuntimeFaultFaultMsg)6 TaskInProgressFaultMsg (com.vmware.vim25.TaskInProgressFaultMsg)6 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)5 FileURL (com.mucommander.commons.file.FileURL)2 GuestFileAttributes (com.vmware.vim25.GuestFileAttributes)2 GuestFileInfo (com.vmware.vim25.GuestFileInfo)2 GuestListFileInfo (com.vmware.vim25.GuestListFileInfo)2 AbstractFile (com.mucommander.commons.file.AbstractFile)1 FileTransferInformation (com.vmware.vim25.FileTransferInformation)1 HttpURLConnection (java.net.HttpURLConnection)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 URLConnection (java.net.URLConnection)1 ArrayList (java.util.ArrayList)1 HttpsURLConnection (javax.net.ssl.HttpsURLConnection)1 DatatypeConfigurationException (javax.xml.datatype.DatatypeConfigurationException)1