VirtualBox

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

Last change on this file since 16237 was 16237, checked in by vboxsync, 16 years ago

OVF: add separate IAppliance::interpret() method, API docs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.4 KB
Line 
1/* $Id: ApplianceImpl.h 16237 2009-01-26 15:06:34Z 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
29class VirtualBox;
30
31class ATL_NO_VTABLE Appliance :
32 public VirtualBoxBaseWithChildrenNEXT,
33 public VirtualBoxSupportErrorInfoImpl <Appliance, IAppliance>,
34 public VirtualBoxSupportTranslation <Appliance>,
35 public IAppliance
36{
37
38public:
39
40 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (Appliance)
41
42 DECLARE_NOT_AGGREGATABLE(Appliance)
43
44 DECLARE_PROTECT_FINAL_CONSTRUCT()
45
46 BEGIN_COM_MAP(Appliance)
47 COM_INTERFACE_ENTRY(ISupportErrorInfo)
48 COM_INTERFACE_ENTRY(IAppliance)
49 END_COM_MAP()
50
51 NS_DECL_ISUPPORTS
52
53 DECLARE_EMPTY_CTOR_DTOR (Appliance)
54
55 // public initializer/uninitializer for internal purposes only
56 HRESULT FinalConstruct() { return S_OK; }
57 void FinalRelease() { uninit(); }
58
59 HRESULT init(VirtualBox *aVirtualBox, IN_BSTR &path);
60 void uninit();
61
62 // for VirtualBoxSupportErrorInfoImpl
63 static const wchar_t *getComponentName() { return L"Appliance"; }
64
65 /* IAppliance properties */
66 STDMETHOD(COMGETTER(Path))(BSTR *aPath);
67
68 STDMETHOD(COMGETTER(VirtualSystemDescriptions))(ComSafeArrayOut (IVirtualSystemDescription*, aVirtualSystemDescriptions));
69
70 /* IAppliance methods */
71 /* void interpret (); */
72 STDMETHOD(Interpret)(void);
73
74 /* void getDisks (out unsigned long aDisksSize, [array, size_is (aDisksSize)] out wstring aDisks, [retval] out unsigned long cDisks); */
75 STDMETHOD(GetDisks)(ComSafeArrayOut(BSTR, aDisks), ULONG *cDisks);
76
77 /* public methods only for internal purposes */
78 STDMETHOD(ImportAppliance)();
79
80 /* private instance data */
81private:
82 /** weak VirtualBox parent */
83 const ComObjPtr <VirtualBox, ComWeakRef> mVirtualBox;
84
85 struct Data; // obscure, defined in AppliannceImpl.cpp
86 Data *m;
87
88 HRESULT LoopThruSections(const char *pcszPath, const xml::Node *pReferencesElem, const xml::Node *pCurElem);
89 HRESULT HandleDiskSection(const char *pcszPath, const xml::Node *pReferencesElem, const xml::Node *pSectionElem);
90 HRESULT HandleNetworkSection(const char *pcszPath, const xml::Node *pSectionElem);
91 HRESULT HandleVirtualSystemContent(const char *pcszPath, const xml::Node *pContentElem);
92
93 HRESULT searchUniqueVMName (std::string& aName);
94};
95
96
97#include <string>
98struct VirtualSystemDescriptionEntry
99{
100 VirtualSystemDescriptionType_T type; /* Of which type is this value */
101 uint64_t ref; /* Reference value to the internal implementation */
102 std::string strOriginalValue; /* The original ovf value */
103 std::string strAutoValue; /* The value which vbox suggest */
104 std::string strFinalValue; /* The value the user select */
105 std::string strConfiguration; /* Additional configuration data for this type */
106};
107
108class ATL_NO_VTABLE VirtualSystemDescription :
109 public VirtualBoxBaseWithChildrenNEXT,
110 public VirtualBoxSupportErrorInfoImpl <VirtualSystemDescription, IVirtualSystemDescription>,
111 public VirtualBoxSupportTranslation <VirtualSystemDescription>,
112 public IVirtualSystemDescription
113{
114 friend class Appliance;
115public:
116 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (VirtualSystemDescription)
117
118 DECLARE_NOT_AGGREGATABLE(VirtualSystemDescription)
119
120 DECLARE_PROTECT_FINAL_CONSTRUCT()
121
122 BEGIN_COM_MAP(VirtualSystemDescription)
123 COM_INTERFACE_ENTRY(ISupportErrorInfo)
124 COM_INTERFACE_ENTRY(IVirtualSystemDescription)
125 END_COM_MAP()
126
127 NS_DECL_ISUPPORTS
128
129 DECLARE_EMPTY_CTOR_DTOR (VirtualSystemDescription)
130
131 // public initializer/uninitializer for internal purposes only
132 HRESULT FinalConstruct() { return S_OK; }
133 void FinalRelease() { uninit(); }
134
135 HRESULT init();
136 void uninit();
137
138 // for VirtualBoxSupportErrorInfoImpl
139 static const wchar_t *getComponentName() { return L"VirtualSystemDescription"; }
140
141 /* IVirtualSystemDescription properties */
142
143 /* IVirtualSystemDescription methods */
144 STDMETHOD(GetDescription) (ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
145 ComSafeArrayOut(ULONG, aRefs),
146 ComSafeArrayOut(BSTR, aOrigValues),
147 ComSafeArrayOut(BSTR, aAutoValues),
148 ComSafeArrayOut(BSTR, aConfigurations));
149 STDMETHOD(SetFinalValues) (ComSafeArrayIn (IN_BSTR, aFinalValues));
150
151 /* public methods only for internal purposes */
152
153 /* private instance data */
154private:
155 void addEntry(VirtualSystemDescriptionType_T aType, ULONG aRef, std::string aOrigValue, std::string aAutoValue);
156 std::list<VirtualSystemDescriptionEntry> findByType(VirtualSystemDescriptionType_T aType);
157
158 struct Data;
159 Data *m;
160};
161
162#endif // ____H_APPLIANCEIMPL
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette