vboxapi.py revision 2fd917a77df587742609eaa229c7cf4922458ae8
#
# Copyright (C) 2009 Sun Microsystems, Inc.
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
# Clara, CA 95054 USA or visit http://www.sun.com if you need
# additional information or have any questions.
#
import traceback
if VboxBinDir is None:
# @todo: To be set by installer
VboxBinDir = "/home/nike/work/ws/out/linux.amd64/debug/bin/"
if VboxSdkDir is None:
from VirtualBox_constants import VirtualBoxReflectionInfo
class PlatformMSCOM:
class ConstantFake:
try:
except:
raise AttributeError
import win32com
raise AttributeError
if fake != None:
return fake
try:
while parent != None:
if name is not None:
else:
print "ask",name
except AttributeError,e:
return fake
class InterfacesWrapper:
def __getattr__(self, a):
import win32com
if a.startswith("__"):
raise AttributeError
try:
except AttributeError,e:
import win32com
import pythoncom
import win32api
#win32com.client.gencache.EnsureDispatch('VirtualBox.Session')
#win32com.client.gencache.EnsureDispatch('VirtualBox.VirtualBox')
def getSessionObject(self):
import win32com
def getVirtualBox(self):
import win32com
def getConstants(self):
return 'MSCOM'
return False
def initPerThread(self):
import pythoncom
# or with pythoncom.COINIT_APARTMENTTHREADED?
def deinitPerThread(self):
import pythoncom
class PlatformXPCOM:
import xpcom
import xpcom.components
def getSessionObject(self):
import xpcom.components
def getVirtualBox(self):
import xpcom.components
def getConstants(self):
import xpcom.components
return 'XPCOM'
return False
def initPerThread(self):
pass
def deinitPerThread(self):
pass
class PlatformWEBSERVICE:
import VirtualBox_services
import VirtualBox_wrappers
from VirtualBox_wrappers import IWebsessionManager
from VirtualBox_wrappers import g_port
from VirtualBox_wrappers import g_reflectionInfo
def getSessionObject(self):
def getVirtualBox(self):
def getConstants(self):
from VirtualBox_wrappers import g_reflectionInfo
return g_reflectionInfo
return 'WEBSERVICE'
return True
def initPerThread(self):
pass
def deinitPerThread(self):
pass
class SessionManager:
class VirtualBoxManager:
if style is None:
style = "MSCOM"
else:
style = "XPCOM"
try:
except Exception,e:
print "init exception: ",e
raise e
def getVirtualBox(self):
def initPerThread(self):
def deinitPerThread(self):