VirtualBox

source: vbox/trunk/src/VBox/Main/include/ApplianceImpl.h@ 16560

Last change on this file since 16560 was 16560, checked in by vboxsync, 15 years ago

Main: do not include include/VBox/settings.h from other header files but only from implementations that need it (save compile time)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 KB
Line 
1/* $Id: ApplianceImpl.h 16560 2009-02-06 18:06:04Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20 * Clara, CA 95054 USA or visit http://www.sun.com if you need
21 * additional information or have any questions.
22 */
23
24#ifndef ____H_APPLIANCEIMPL
25#define ____H_APPLIANCEIMPL
26
27#include "VirtualBoxBase.h"
28
29namespace xml
30{
31 class Node;
32}
33
34class VirtualBox;
35
36class ATL_NO_VTABLE Appliance :
37 public VirtualBoxBaseWithChildrenNEXT,
38 public VirtualBoxSupportErrorInfoImpl <Appliance, IAppliance>,
39 public VirtualBoxSupportTranslation <Appliance>,
40 public IAppliance
41{
42
43public:
44
45 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (Appliance)
46
47 DECLARE_NOT_AGGREGATABLE(Appliance)
48
49 DECLARE_PROTECT_FINAL_CONSTRUCT()
50
51 BEGIN_COM_MAP(Appliance)
52 COM_INTERFACE_ENTRY(ISupportErrorInfo)
53 COM_INTERFACE_ENTRY(IAppliance)
54 END_COM_MAP()
55
56 NS_DECL_ISUPPORTS
57
58 DECLARE_EMPTY_CTOR_DTOR (Appliance)
59
60 // public initializer/uninitializer for internal purposes only
61 HRESULT FinalConstruct() { return S_OK; }
62 void FinalRelease() { uninit(); }
63
64 HRESULT init(VirtualBox *aVirtualBox, IN_BSTR &path);
65 void uninit();
66
67 // for VirtualBoxSupportErrorInfoImpl
68 static const wchar_t *getComponentName() { return L"Appliance"; }
69
70 /* IAppliance properties */
71 STDMETHOD(COMGETTER(Path))(BSTR *aPath);
72 STDMETHOD(COMGETTER(Disks))(ComSafeArrayOut(BSTR, aDisks));
73 STDMETHOD(COMGETTER(VirtualSystemDescriptions))(ComSafeArrayOut(IVirtualSystemDescription*, aVirtualSystemDescriptions));
74
75 /* IAppliance methods */
76 /* void interpret (); */
77 STDMETHOD(Interpret)(void);
78 STDMETHOD(ImportAppliance)(IProgress **aProgress);
79
80 /* public methods only for internal purposes */
81
82 /* private instance data */
83private:
84 /** weak VirtualBox parent */
85 const ComObjPtr <VirtualBox, ComWeakRef> mVirtualBox;
86
87 struct Task; /* Worker thread for import */
88
89 struct Data; // obscure, defined in AppliannceImpl.cpp
90 Data *m;
91
92 HRESULT LoopThruSections(const char *pcszPath, const xml::Node *pReferencesElem, const xml::Node *pCurElem);
93 HRESULT HandleDiskSection(const char *pcszPath, const xml::Node *pReferencesElem, const xml::Node *pSectionElem);
94 HRESULT HandleNetworkSection(const char *pcszPath, const xml::Node *pSectionElem);
95 HRESULT HandleVirtualSystemContent(const char *pcszPath, const xml::Node *pContentElem);
96
97 HRESULT searchUniqueVMName(Utf8Str& aName) const;
98 HRESULT searchUniqueDiskImageFilePath(Utf8Str& aName) const;
99
100 static DECLCALLBACK(int) taskThread(RTTHREAD thread, void *pvUser);
101};
102
103struct VirtualSystemDescriptionEntry
104{
105 uint32_t ulIndex; // zero-based index of this entry within array
106 VirtualSystemDescriptionType_T type; // type of this entry
107 Utf8Str strRef; // reference number (hard disk controllers only)
108 Utf8Str strOrig; // original OVF value (type-dependent)
109 Utf8Str strConfig; // configuration value (type-dependent)
110 Utf8Str strExtraConfig; // extra configuration key=value strings (type-dependent)
111};
112
113class ATL_NO_VTABLE VirtualSystemDescription :
114 public VirtualBoxBaseWithChildrenNEXT,
115 public VirtualBoxSupportErrorInfoImpl <VirtualSystemDescription, IVirtualSystemDescription>,
116 public VirtualBoxSupportTranslation <VirtualSystemDescription>,
117 public IVirtualSystemDescription
118{
119 friend class Appliance;
120public:
121 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (VirtualSystemDescription)
122
123 DECLARE_NOT_AGGREGATABLE(VirtualSystemDescription)
124
125 DECLARE_PROTECT_FINAL_CONSTRUCT()
126
127 BEGIN_COM_MAP(VirtualSystemDescription)
128 COM_INTERFACE_ENTRY(ISupportErrorInfo)
129 COM_INTERFACE_ENTRY(IVirtualSystemDescription)
130 END_COM_MAP()
131
132 NS_DECL_ISUPPORTS
133
134 DECLARE_EMPTY_CTOR_DTOR (VirtualSystemDescription)
135
136 // public initializer/uninitializer for internal purposes only
137 HRESULT FinalConstruct() { return S_OK; }
138 void FinalRelease() { uninit(); }
139
140 HRESULT init();
141 void uninit();
142
143 // for VirtualBoxSupportErrorInfoImpl
144 static const wchar_t *getComponentName() { return L"VirtualSystemDescription"; }
145
146 /* IVirtualSystemDescription properties */
147
148 /* IVirtualSystemDescription methods */
149 STDMETHOD(GetDescription)(ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
150 ComSafeArrayOut(BSTR, aRefs),
151 ComSafeArrayOut(BSTR, aOrigValues),
152 ComSafeArrayOut(BSTR, aConfigValues),
153 ComSafeArrayOut(BSTR, aExtraConfigValues));
154 STDMETHOD(DisableItem)(ULONG index);
155 STDMETHOD(SetFinalValues)(ComSafeArrayIn(IN_BSTR, aFinalValues));
156
157 /* public methods only for internal purposes */
158
159 /* private instance data */
160private:
161 void addEntry(VirtualSystemDescriptionType_T aType,
162 const Utf8Str &strRef,
163 const Utf8Str &aOrigValue,
164 const Utf8Str &aAutoValue,
165 const Utf8Str &strExtraConfig = "");
166
167 std::list<VirtualSystemDescriptionEntry*> findByType(VirtualSystemDescriptionType_T aType);
168 const VirtualSystemDescriptionEntry* findControllerFromID(uint32_t id);
169
170 struct Data;
171 Data *m;
172};
173
174#endif // ____H_APPLIANCEIMPL
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use