VirtualBox

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

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

OVF: Added VirtualBox object member, make the vm name unique & use them on import.

  • 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 16218 2009-01-26 10:16:38Z 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 /* IAppliance methods */
69 /* void getDisks (out unsigned long aDisksSize, [array, size_is (aDisksSize)] out wstring aDisks, [retval] out unsigned long cDisks); */
70 STDMETHOD(GetDisks) (ComSafeArrayOut(BSTR, aDisks), ULONG *cDisks);
71
72 STDMETHOD (COMGETTER (VirtualSystemDescriptions)) (ComSafeArrayOut (IVirtualSystemDescription*, aVirtualSystemDescriptions));
73
74 /* public methods only for internal purposes */
75 STDMETHOD (ImportAppliance)();
76
77 /* private instance data */
78private:
79 /** weak VirtualBox parent */
80 const ComObjPtr <VirtualBox, ComWeakRef> mVirtualBox;
81
82 struct Data; // obscure, defined in AppliannceImpl.cpp
83 Data *m;
84
85 HRESULT LoopThruSections(const char *pcszPath, const xml::Node *pReferencesElem, const xml::Node *pCurElem);
86 HRESULT HandleDiskSection(const char *pcszPath, const xml::Node *pReferencesElem, const xml::Node *pSectionElem);
87 HRESULT HandleNetworkSection(const char *pcszPath, const xml::Node *pSectionElem);
88 HRESULT HandleVirtualSystemContent(const char *pcszPath, const xml::Node *pContentElem);
89
90 HRESULT construeAppliance();
91 HRESULT searchUniqueVMName (std::string& aName);
92};
93
94
95#include <string>
96struct VirtualSystemDescriptionEntry
97{
98 VirtualSystemDescriptionType_T type; /* Of which type is this value */
99 uint64_t ref; /* Reference value to the internal implementation */
100 std::string strOriginalValue; /* The original ovf value */
101 std::string strAutoValue; /* The value which vbox suggest */
102 std::string strFinalValue; /* The value the user select */
103 std::string strConfiguration; /* Additional configuration data for this type */
104};
105
106class ATL_NO_VTABLE VirtualSystemDescription :
107 public VirtualBoxBaseWithChildrenNEXT,
108 public VirtualBoxSupportErrorInfoImpl <VirtualSystemDescription, IVirtualSystemDescription>,
109 public VirtualBoxSupportTranslation <VirtualSystemDescription>,
110 public IVirtualSystemDescription
111{
112 friend class Appliance;
113public:
114 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (VirtualSystemDescription)
115
116 DECLARE_NOT_AGGREGATABLE(VirtualSystemDescription)
117
118 DECLARE_PROTECT_FINAL_CONSTRUCT()
119
120 BEGIN_COM_MAP(VirtualSystemDescription)
121 COM_INTERFACE_ENTRY(ISupportErrorInfo)
122 COM_INTERFACE_ENTRY(IVirtualSystemDescription)
123 END_COM_MAP()
124
125 NS_DECL_ISUPPORTS
126
127 DECLARE_EMPTY_CTOR_DTOR (VirtualSystemDescription)
128
129 // public initializer/uninitializer for internal purposes only
130 HRESULT FinalConstruct() { return S_OK; }
131 void FinalRelease() { uninit(); }
132
133 HRESULT init();
134 void uninit();
135
136 // for VirtualBoxSupportErrorInfoImpl
137 static const wchar_t *getComponentName() { return L"VirtualSystemDescription"; }
138
139 /* IVirtualSystemDescription properties */
140
141 /* IVirtualSystemDescription methods */
142 STDMETHOD(GetDescription) (ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
143 ComSafeArrayOut(ULONG, aRefs),
144 ComSafeArrayOut(BSTR, aOrigValues),
145 ComSafeArrayOut(BSTR, aAutoValues),
146 ComSafeArrayOut(BSTR, aConfigurations));
147 STDMETHOD(SetFinalValues) (ComSafeArrayIn (IN_BSTR, aFinalValues));
148
149 /* public methods only for internal purposes */
150
151 /* private instance data */
152private:
153 void addEntry (VirtualSystemDescriptionType_T aType, ULONG aRef, std::string aOrigValue, std::string aAutoValue);
154 std::list<VirtualSystemDescriptionEntry> findByType (VirtualSystemDescriptionType_T aType);
155
156 struct Data;
157 Data *m;
158};
159
160#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