ApplianceImpl.h revision 3221ae1f7bf53d9cccdd578099f55f782dba1447
0N/A/* $Id$ */
0N/A
0N/A/** @file
0N/A *
0N/A * VirtualBox COM class implementation
0N/A */
0N/A
0N/A/*
0N/A * Copyright (C) 2006-2009 Sun Microsystems, Inc.
0N/A *
0N/A * This file is part of VirtualBox Open Source Edition (OSE), as
0N/A * available from http://www.virtualbox.org. This file is free software;
0N/A * you can redistribute it and/or modify it under the terms of the GNU
0N/A * General Public License (GPL) as published by the Free Software
0N/A * Foundation, in version 2 as it comes in the "COPYING" file of the
0N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
0N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
0N/A *
0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
0N/A * Clara, CA 95054 USA or visit http://www.sun.com if you need
0N/A * additional information or have any questions.
0N/A */
0N/A
0N/A#ifndef ____H_APPLIANCEIMPL
0N/A#define ____H_APPLIANCEIMPL
0N/A
0N/A#include "VirtualBoxBase.h"
0N/A
0N/Anamespace xml
0N/A{
0N/A class Node;
0N/A class ElementNode;
0N/A}
0N/A
0N/Aclass VirtualBox;
0N/A
0N/Aclass ATL_NO_VTABLE Appliance :
0N/A public VirtualBoxBaseWithChildrenNEXT,
0N/A public VirtualBoxSupportErrorInfoImpl <Appliance, IAppliance>,
0N/A public VirtualBoxSupportTranslation <Appliance>,
0N/A public IAppliance
0N/A{
0N/A
0N/Apublic:
0N/A
0N/A VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (Appliance)
0N/A
0N/A DECLARE_NOT_AGGREGATABLE(Appliance)
0N/A
0N/A DECLARE_PROTECT_FINAL_CONSTRUCT()
0N/A
0N/A BEGIN_COM_MAP(Appliance)
0N/A COM_INTERFACE_ENTRY(ISupportErrorInfo)
0N/A COM_INTERFACE_ENTRY(IAppliance)
0N/A END_COM_MAP()
0N/A
0N/A NS_DECL_ISUPPORTS
0N/A
0N/A DECLARE_EMPTY_CTOR_DTOR (Appliance)
0N/A
0N/A // public initializer/uninitializer for internal purposes only
0N/A HRESULT FinalConstruct() { return S_OK; }
0N/A void FinalRelease() { uninit(); }
0N/A
0N/A HRESULT init(VirtualBox *aVirtualBox);
0N/A void uninit();
0N/A
0N/A // for VirtualBoxSupportErrorInfoImpl
0N/A static const wchar_t *getComponentName() { return L"Appliance"; }
0N/A
0N/A /* IAppliance properties */
0N/A STDMETHOD(COMGETTER(Path))(BSTR *aPath);
0N/A STDMETHOD(COMGETTER(Disks))(ComSafeArrayOut(BSTR, aDisks));
0N/A STDMETHOD(COMGETTER(VirtualSystemDescriptions))(ComSafeArrayOut(IVirtualSystemDescription*, aVirtualSystemDescriptions));
0N/A
0N/A /* IAppliance methods */
0N/A STDMETHOD(Read)(IN_BSTR path);
0N/A STDMETHOD(Interpret)(void);
0N/A STDMETHOD(ImportMachines)(IProgress **aProgress);
0N/A STDMETHOD(Write)(IN_BSTR path, IProgress **aProgress);
0N/A /* public methods only for internal purposes */
0N/A
0N/A /* private instance data */
0N/Aprivate:
0N/A /** weak VirtualBox parent */
0N/A const ComObjPtr <VirtualBox, ComWeakRef> mVirtualBox;
0N/A
0N/A struct Data; // obscure, defined in AppliannceImpl.cpp
0N/A Data *m;
0N/A
0N/A HRESULT LoopThruSections(const char *pcszPath, const xml::ElementNode *pReferencesElem, const xml::ElementNode *pCurElem);
0N/A HRESULT HandleDiskSection(const char *pcszPath, const xml::ElementNode *pReferencesElem, const xml::ElementNode *pSectionElem);
0N/A HRESULT HandleNetworkSection(const char *pcszPath, const xml::ElementNode *pSectionElem);
0N/A HRESULT HandleVirtualSystemContent(const char *pcszPath, const xml::ElementNode *pContentElem);
0N/A
0N/A HRESULT searchUniqueVMName(Utf8Str& aName) const;
0N/A HRESULT searchUniqueDiskImageFilePath(Utf8Str& aName) const;
0N/A uint32_t calcMaxProgress();
0N/A
0N/A struct TaskImportMachines; /* Worker thread for import */
0N/A static DECLCALLBACK(int) taskThreadImportMachines(RTTHREAD thread, void *pvUser);
0N/A
0N/A struct TaskExportOVF; /* Worker thread for export */
0N/A static DECLCALLBACK(int) taskThreadExportOVF(RTTHREAD thread, void *pvUser);
0N/A
0N/A friend class Machine;
0N/A};
0N/A
0N/Astruct VirtualSystemDescriptionEntry
0N/A{
0N/A uint32_t ulIndex; // zero-based index of this entry within array
0N/A VirtualSystemDescriptionType_T type; // type of this entry
0N/A Utf8Str strRef; // reference number (hard disk controllers only)
0N/A Utf8Str strOvf; // original OVF value (type-dependent)
0N/A Utf8Str strVbox; // configuration value (type-dependent)
0N/A Utf8Str strExtraConfig; // extra configuration key=value strings (type-dependent)
0N/A};
0N/A
0N/Aclass ATL_NO_VTABLE VirtualSystemDescription :
0N/A public VirtualBoxBaseWithChildrenNEXT,
0N/A public VirtualBoxSupportErrorInfoImpl <VirtualSystemDescription, IVirtualSystemDescription>,
0N/A public VirtualBoxSupportTranslation <VirtualSystemDescription>,
54N/A public IVirtualSystemDescription
54N/A{
54N/A friend class Appliance;
54N/Apublic:
0N/A VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (VirtualSystemDescription)
0N/A
0N/A DECLARE_NOT_AGGREGATABLE(VirtualSystemDescription)
0N/A
0N/A DECLARE_PROTECT_FINAL_CONSTRUCT()
0N/A
0N/A BEGIN_COM_MAP(VirtualSystemDescription)
0N/A COM_INTERFACE_ENTRY(ISupportErrorInfo)
0N/A COM_INTERFACE_ENTRY(IVirtualSystemDescription)
0N/A END_COM_MAP()
0N/A
0N/A NS_DECL_ISUPPORTS
0N/A
0N/A DECLARE_EMPTY_CTOR_DTOR (VirtualSystemDescription)
0N/A
0N/A // public initializer/uninitializer for internal purposes only
0N/A HRESULT FinalConstruct() { return S_OK; }
0N/A void FinalRelease() { uninit(); }
0N/A
0N/A HRESULT init();
0N/A void uninit();
0N/A
0N/A // for VirtualBoxSupportErrorInfoImpl
0N/A static const wchar_t *getComponentName() { return L"VirtualSystemDescription"; }
0N/A
0N/A /* IVirtualSystemDescription properties */
0N/A STDMETHOD(COMGETTER(Count))(ULONG *aCount);
0N/A
0N/A /* IVirtualSystemDescription methods */
0N/A STDMETHOD(GetDescription)(ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
0N/A ComSafeArrayOut(BSTR, aRefs),
0N/A ComSafeArrayOut(BSTR, aOvfValues),
0N/A ComSafeArrayOut(BSTR, aVboxValues),
0N/A ComSafeArrayOut(BSTR, aExtraConfigValues));
0N/A
0N/A STDMETHOD(SetFinalValues)(ComSafeArrayIn(BOOL, aEnabled),
0N/A ComSafeArrayIn(IN_BSTR, aVboxValues),
0N/A ComSafeArrayIn(IN_BSTR, aExtraConfigValues));
0N/A
0N/A STDMETHOD(GetWarnings)(ComSafeArrayOut(BSTR, aWarnings));
0N/A
0N/A /* public methods only for internal purposes */
0N/A
58N/A void addEntry(VirtualSystemDescriptionType_T aType,
0N/A const Utf8Str &strRef,
58N/A const Utf8Str &aOrigValue,
58N/A const Utf8Str &aAutoValue,
58N/A const Utf8Str &strExtraConfig = "");
0N/A
0N/A void addWarning(const char* aWarning, ...);
0N/A
0N/A std::list<VirtualSystemDescriptionEntry*> findByType(VirtualSystemDescriptionType_T aType);
0N/A const VirtualSystemDescriptionEntry* findControllerFromID(uint32_t id);
0N/A
0N/A /* private instance data */
0N/Aprivate:
0N/A struct Data;
0N/A Data *m;
0N/A
0N/A friend class Machine;
0N/A};
0N/A
0N/A#endif // ____H_APPLIANCEIMPL
0N/A