

/**
 * 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 ISession extends IUnknown {

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

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

    // read-only attribute ISession::state of type SessionState
    public org.virtualbox.SessionState getState() {
        try {
            org.virtualbox.SessionState retVal = port.iSessionGetState(_this);
            return retVal;
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

    // read-only attribute ISession::type of type SessionType
    public org.virtualbox.SessionType getType() {
        try {
            org.virtualbox.SessionType retVal = port.iSessionGetType(_this);
            return retVal;
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }

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

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

    /* method ISession::close()
     */
    public void close() {
        try {
            port.iSessionClose(_this);
        } catch (InvalidObjectFaultMsg e) {
            throw new WebServiceException(e);
        } catch (RuntimeFaultMsg e) {
            throw new WebServiceException(e);
        }
    }
}
