ApplianceImpl.h revision d91dc86210d602f51a4701762488a5e696c80a45
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/* $Id$ */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/** @file
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync *
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * VirtualBox COM class implementation
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/*
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Copyright (C) 2006-2009 Sun Microsystems, Inc.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync *
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * available from http://www.virtualbox.org. This file is free software;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * you can redistribute it and/or modify it under the terms of the GNU
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * General Public License (GPL) as published by the Free Software
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync *
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * additional information or have any questions.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#ifndef ____H_APPLIANCEIMPL
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#define ____H_APPLIANCEIMPL
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#include "VirtualBoxBase.h"
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
d91dc86210d602f51a4701762488a5e696c80a45vboxsync// #include <string>
d440eb388d1459ffc6f581ff0c786ef3f048dc39vboxsync
482a222498aae619afda0255a7edf4ebda97268cvboxsyncclass VirtualBox;
482a222498aae619afda0255a7edf4ebda97268cvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncclass ATL_NO_VTABLE Appliance :
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync public VirtualBoxBaseWithChildrenNEXT,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync public VirtualBoxSupportErrorInfoImpl <Appliance, IAppliance>,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync public VirtualBoxSupportTranslation <Appliance>,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync public IAppliance
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync{
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncpublic:
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (Appliance)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync DECLARE_NOT_AGGREGATABLE(Appliance)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync DECLARE_PROTECT_FINAL_CONSTRUCT()
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync BEGIN_COM_MAP(Appliance)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync COM_INTERFACE_ENTRY(ISupportErrorInfo)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync COM_INTERFACE_ENTRY(IAppliance)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync END_COM_MAP()
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync NS_DECL_ISUPPORTS
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync DECLARE_EMPTY_CTOR_DTOR (Appliance)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync // public initializer/uninitializer for internal purposes only
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync HRESULT FinalConstruct() { return S_OK; }
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync void FinalRelease() { uninit(); }
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
ee5869bb73f07de9c139dc6a608836a7b5767933vboxsync HRESULT init(VirtualBox *aVirtualBox, IN_BSTR &path);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync void uninit();
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync // for VirtualBoxSupportErrorInfoImpl
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync static const wchar_t *getComponentName() { return L"Appliance"; }
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /* IAppliance properties */
ee5869bb73f07de9c139dc6a608836a7b5767933vboxsync STDMETHOD(COMGETTER(Path))(BSTR *aPath);
f6dde23cd488aee26203b38ec67220270f5c4273vboxsync STDMETHOD(COMGETTER(Disks))(ComSafeArrayOut(BSTR, aDisks));
f6dde23cd488aee26203b38ec67220270f5c4273vboxsync STDMETHOD(COMGETTER(VirtualSystemDescriptions))(ComSafeArrayOut(IVirtualSystemDescription*, aVirtualSystemDescriptions));
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /* IAppliance methods */
ee5869bb73f07de9c139dc6a608836a7b5767933vboxsync /* void interpret (); */
ee5869bb73f07de9c139dc6a608836a7b5767933vboxsync STDMETHOD(Interpret)(void);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /* public methods only for internal purposes */
ee5869bb73f07de9c139dc6a608836a7b5767933vboxsync STDMETHOD(ImportAppliance)();
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /* private instance data */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncprivate:
482a222498aae619afda0255a7edf4ebda97268cvboxsync /** weak VirtualBox parent */
482a222498aae619afda0255a7edf4ebda97268cvboxsync const ComObjPtr <VirtualBox, ComWeakRef> mVirtualBox;
482a222498aae619afda0255a7edf4ebda97268cvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync struct Data; // obscure, defined in AppliannceImpl.cpp
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync Data *m;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync HRESULT LoopThruSections(const char *pcszPath, const xml::Node *pReferencesElem, const xml::Node *pCurElem);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync HRESULT HandleDiskSection(const char *pcszPath, const xml::Node *pReferencesElem, const xml::Node *pSectionElem);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync HRESULT HandleNetworkSection(const char *pcszPath, const xml::Node *pSectionElem);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync HRESULT HandleVirtualSystemContent(const char *pcszPath, const xml::Node *pContentElem);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
d91dc86210d602f51a4701762488a5e696c80a45vboxsync HRESULT searchUniqueVMName(Utf8Str& aName) const;
d91dc86210d602f51a4701762488a5e696c80a45vboxsync HRESULT searchUniqueDiskImageFilePath(Utf8Str& aName) const;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync};
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncstruct VirtualSystemDescriptionEntry
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync{
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync VirtualSystemDescriptionType_T type; /* Of which type is this value */
d91dc86210d602f51a4701762488a5e696c80a45vboxsync Utf8Str strRef; /* Reference value to the internal implementation */
d91dc86210d602f51a4701762488a5e696c80a45vboxsync Utf8Str strOriginalValue; /* The original OVF value */
d91dc86210d602f51a4701762488a5e696c80a45vboxsync Utf8Str strAutoValue; /* The value which VBox suggest */
d91dc86210d602f51a4701762488a5e696c80a45vboxsync Utf8Str strFinalValue; /* The value the user select */
d91dc86210d602f51a4701762488a5e696c80a45vboxsync Utf8Str strConfiguration; /* Additional configuration data for this type */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync};
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncclass ATL_NO_VTABLE VirtualSystemDescription :
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync public VirtualBoxBaseWithChildrenNEXT,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync public VirtualBoxSupportErrorInfoImpl <VirtualSystemDescription, IVirtualSystemDescription>,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync public VirtualBoxSupportTranslation <VirtualSystemDescription>,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync public IVirtualSystemDescription
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync{
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync friend class Appliance;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncpublic:
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (VirtualSystemDescription)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync DECLARE_NOT_AGGREGATABLE(VirtualSystemDescription)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync DECLARE_PROTECT_FINAL_CONSTRUCT()
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync BEGIN_COM_MAP(VirtualSystemDescription)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync COM_INTERFACE_ENTRY(ISupportErrorInfo)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync COM_INTERFACE_ENTRY(IVirtualSystemDescription)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync END_COM_MAP()
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync NS_DECL_ISUPPORTS
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync DECLARE_EMPTY_CTOR_DTOR (VirtualSystemDescription)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync // public initializer/uninitializer for internal purposes only
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync HRESULT FinalConstruct() { return S_OK; }
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync void FinalRelease() { uninit(); }
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync HRESULT init();
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync void uninit();
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync // for VirtualBoxSupportErrorInfoImpl
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync static const wchar_t *getComponentName() { return L"VirtualSystemDescription"; }
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /* IVirtualSystemDescription properties */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /* IVirtualSystemDescription methods */
f6dde23cd488aee26203b38ec67220270f5c4273vboxsync STDMETHOD(GetDescription)(ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
f6dde23cd488aee26203b38ec67220270f5c4273vboxsync ComSafeArrayOut(BSTR, aOrigValues),
f6dde23cd488aee26203b38ec67220270f5c4273vboxsync ComSafeArrayOut(BSTR, aAutoValues),
f6dde23cd488aee26203b38ec67220270f5c4273vboxsync ComSafeArrayOut(BSTR, aConfigurations));
f6dde23cd488aee26203b38ec67220270f5c4273vboxsync STDMETHOD(SetFinalValues)(ComSafeArrayIn(IN_BSTR, aFinalValues));
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /* public methods only for internal purposes */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /* private instance data */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncprivate:
f9cac318205d74ee5b35dabcf2bd39118f6293d7vboxsync void addEntry(VirtualSystemDescriptionType_T aType,
d91dc86210d602f51a4701762488a5e696c80a45vboxsync const Utf8Str &aRef,
d91dc86210d602f51a4701762488a5e696c80a45vboxsync const Utf8Str &aOrigValue,
d91dc86210d602f51a4701762488a5e696c80a45vboxsync const Utf8Str &aAutoValue,
d91dc86210d602f51a4701762488a5e696c80a45vboxsync const Utf8Str &aConfig = "");
f9cac318205d74ee5b35dabcf2bd39118f6293d7vboxsync
f9cac318205d74ee5b35dabcf2bd39118f6293d7vboxsync std::list<VirtualSystemDescriptionEntry*> findByType(VirtualSystemDescriptionType_T aType);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync struct Data;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync Data *m;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync};
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync#endif // ____H_APPLIANCEIMPL