vboxapi.py revision 3acd338a7a2154c8d73de9a2629bc7057b051334
#
# 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:
# Will be set by the installer
VboxBinDir = "%VBOX_INSTALL_PATH%"
if VboxSdkDir is None:
from VirtualBox_constants import VirtualBoxReflectionInfo
class PlatformMSCOM:
# Class to fake access to constants in style of foo.bar.boo
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:
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
import win32com
def getVirtualBox(self):
import win32com
def getConstants(self):
return 'MSCOM'
return False
def initPerThread(self):
import pythoncom
def deinitPerThread(self):
import pythoncom
d = {}
d['BaseClass'] = impl
d['arg'] = arg
str = ""
str += "import win32com.server.util"
str += " _typelib_guid_ = '{46137EEC-703B-4FE5-AFD4-7C9BBBBA0259}'\n"
str += " def __init__(self): BaseClass.__init__(self, arg)\n"
exec (str,d,d)
return d['result']
class PlatformXPCOM:
import xpcom
import xpcom.components
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
d = {}
d['BaseClass'] = impl
d['arg'] = arg
str = ""
str += "import xpcom.components\n"
str += " def __init__(self): BaseClass.__init__(self, arg)\n"
exec (str,d,d)
return d['result']
class PlatformWEBSERVICE:
import VirtualBox_services
import VirtualBox_wrappers
from VirtualBox_wrappers import IWebsessionManager2
if params is not None:
else:
def getVirtualBox(self):
def getConstants(self):
return None
return 'WEBSERVICE'
return True
def initPerThread(self):
pass
def deinitPerThread(self):
pass
raise Exception("no callbacks for webservices")
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):
return session
def deinitPerThread(self):