

/**
 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
 * 
 * Sun Microsystems, Inc. confidential
 * All rights reserved
 *
 * This file is autogenerated by glue-jaxws.xsl, DO NOT EDIT! 
 */

package com.sun.xml.ws.commons.virtualbox;

import java.math.BigInteger;
import java.util.List;
import java.util.UUID;
import javax.xml.ws.Holder;
import javax.xml.ws.WebServiceException;
import com.sun.xml.ws.commons.virtualbox.IUnknown;

import org.virtualbox.service.InvalidObjectFaultMsg;
import org.virtualbox.service.RuntimeFaultMsg;
import org.virtualbox.service.VboxService;
import org.virtualbox.service.VboxPortType;

public class IHardDisk extends IUnknown {

    public static IHardDisk cast(IUnknown other) {
        return new IHardDisk(other.getRef(), other.getRemoteWSPort());
    }

    public IHardDisk(String _this, VboxPortType port) {
        super(_this,port);
    }

    // read-only attribute IHardDisk::id of type uuid
    public UUID getId() {
        try {
            String retVal = port.iHardDiskGetId(_this);
            return UUID.fromString(retVal);
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    // read/write attribute IHardDisk::description of type wstring
    public String getDescription() {
        try {
            String retVal = port.iHardDiskGetDescription(_this);
            return retVal;
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }
    public void setDescription(String value) {
        try {
            port.iHardDiskSetDescription(_this, value);
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    // read-only attribute IHardDisk::storageType of type HardDiskStorageType
    public org.virtualbox.HardDiskStorageType getStorageType() {
        try {
            org.virtualbox.HardDiskStorageType retVal = port.iHardDiskGetStorageType(_this);
            return retVal;
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    // read-only attribute IHardDisk::location of type wstring
    public String getLocation() {
        try {
            String retVal = port.iHardDiskGetLocation(_this);
            return retVal;
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    // read/write attribute IHardDisk::type of type HardDiskType
    public org.virtualbox.HardDiskType getType() {
        try {
            org.virtualbox.HardDiskType retVal = port.iHardDiskGetType(_this);
            return retVal;
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }
    public void setType(org.virtualbox.HardDiskType value) {
        try {
            port.iHardDiskSetType(_this, value);
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    // read-only attribute IHardDisk::parent of type IHardDisk
    public com.sun.xml.ws.commons.virtualbox.IHardDisk getParent() {
        try {
            String retVal = port.iHardDiskGetParent(_this);
            return new IHardDisk(retVal, port);
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    // read-only attribute IHardDisk::children of type IHardDiskCollection
    public List<com.sun.xml.ws.commons.virtualbox.IHardDisk> getChildren() {
        try {
            org.virtualbox.ArrayOfIHardDisk retVal = port.iHardDiskGetChildren(_this);
            return Helper.wrap(IHardDisk.class, port, ((retVal == null)?null:retVal.getArray()));
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    // read-only attribute IHardDisk::root of type IHardDisk
    public com.sun.xml.ws.commons.virtualbox.IHardDisk getRoot() {
        try {
            String retVal = port.iHardDiskGetRoot(_this);
            return new IHardDisk(retVal, port);
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    // read-only attribute IHardDisk::accessible of type boolean
    public Boolean getAccessible() {
        try {
            Boolean retVal = port.iHardDiskGetAccessible(_this);
            return retVal;
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    // read-only attribute IHardDisk::allAccessible of type boolean
    public Boolean getAllAccessible() {
        try {
            Boolean retVal = port.iHardDiskGetAllAccessible(_this);
            return retVal;
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    // read-only attribute IHardDisk::lastAccessError of type wstring
    public String getLastAccessError() {
        try {
            String retVal = port.iHardDiskGetLastAccessError(_this);
            return retVal;
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    // read-only attribute IHardDisk::size of type unsigned long long
    public BigInteger getSize() {
        try {
            BigInteger retVal = port.iHardDiskGetSize(_this);
            return retVal;
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    // read-only attribute IHardDisk::actualSize of type unsigned long long
    public BigInteger getActualSize() {
        try {
            BigInteger retVal = port.iHardDiskGetActualSize(_this);
            return retVal;
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    // read-only attribute IHardDisk::machineId of type uuid
    public UUID getMachineId() {
        try {
            String retVal = port.iHardDiskGetMachineId(_this);
            return UUID.fromString(retVal);
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    // read-only attribute IHardDisk::snapshotId of type uuid
    public UUID getSnapshotId() {
        try {
            String retVal = port.iHardDiskGetSnapshotId(_this);
            return UUID.fromString(retVal);
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    /* method IHardDisk::cloneToImage(
            [in] wstring filePath,
            [out] IVirtualDiskImage image,
            [return] IProgress progress)
     */
    public com.sun.xml.ws.commons.virtualbox.IProgress cloneToImage(String filePath, Holder<com.sun.xml.ws.commons.virtualbox.IVirtualDiskImage> image) {
        try {
            Holder<String> tmpimage = new Holder<String>(); 
            Holder<String> retVal = new Holder<String>();
            port.iHardDiskCloneToImage(_this, filePath, tmpimage, retVal);
            image.value = new com.sun.xml.ws.commons.virtualbox.IVirtualDiskImage(tmpimage.value, port);
            return new com.sun.xml.ws.commons.virtualbox.IProgress(retVal.value, port);
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }
}
