Initial project's source code check-in.

This commit is contained in:
ptsurbeleu 2011-07-13 16:07:32 -07:00
commit b03b0b373f
4573 changed files with 981205 additions and 0 deletions

View file

@ -0,0 +1,180 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using WebsitePanel.EnterpriseServer;
namespace WebsitePanel.Ecommerce.EnterpriseServer
{
public class HostingAddon : ProvisioningControllerBase, IProvisioningController
{
public const string ROOT_SERVICE_ID = "RootServiceID";
public const string PACKAGE_ID = "PackageID";
public const string HOSTING_ADDON = "HostingAddon";
public const string PACKAGE_ADDON_ID = "PackageAddonID";
public string PackageAddonID
{
get { return ServiceSettings[PACKAGE_ADDON_ID]; }
set { ServiceSettings[PACKAGE_ADDON_ID] = value; }
}
public HostingAddon(Service serviceInfo)
: base(serviceInfo)
{
}
#region IProvisioningController Members
public void Activate()
{
int packageAddonId = 0;
if (!Int32.TryParse(PackageAddonID, out packageAddonId))
throw new Exception("Unable to parse Package Add-On ID: " + PackageAddonID);
// try to get package addon
PackageAddonInfo addon = PackageController.GetPackageAddon(packageAddonId);
// check returned package
if (addon != null)
{
// workaround for bug in GetPackageAddon routine
addon.PackageAddonId = packageAddonId;
// change package add-on status
addon.StatusId = (int)PackageStatus.Active;
// save package add-on changes
PackageResult result = PackageController.UpdatePackageAddon(addon);
// check returned result
if (result.Result < 0)
throw new Exception("Unable to activate Package Add-On: " + addon.PackageAddonId);
}
}
public void Suspend()
{
int packageAddonId = 0;
if (!Int32.TryParse(PackageAddonID, out packageAddonId))
throw new Exception("Unable to parse Package Add-On ID: " + PackageAddonID);
// try to get package addon
PackageAddonInfo addon = PackageController.GetPackageAddon(packageAddonId);
// check returned package
if (addon != null)
{
// workaround for bug in GetPackageAddon routine
addon.PackageAddonId = packageAddonId;
// change package add-on status
addon.StatusId = (int)PackageStatus.Suspended;
// save package add-on changes
PackageResult result = PackageController.UpdatePackageAddon(addon);
// check returned result
if (result.Result < 0)
throw new Exception("Unable to suspend Package Add-On: " + addon.PackageAddonId);
}
}
public void Cancel()
{
int packageAddonId = 0;
if (!Int32.TryParse(PackageAddonID, out packageAddonId))
throw new Exception("Unable to parse Package Add-On ID: " + PackageAddonID);
// try to get package addon
PackageAddonInfo addon = PackageController.GetPackageAddon(packageAddonId);
// check returned package
if (addon != null)
{
// workaround for bug in GetPackageAddon routine
addon.PackageAddonId = packageAddonId;
// change package add-on status
addon.StatusId = (int)PackageStatus.Cancelled;
// save package add-on changes
PackageResult result = PackageController.UpdatePackageAddon(addon);
// check returned result
if (result.Result < 0)
throw new Exception("Unable to cancel Package Add-On: " + addon.PackageAddonId);
}
}
public void Order()
{
int rootServiceId = Utils.ParseInt(ServiceSettings[ROOT_SERVICE_ID], 0);
// each add-on should have root service id assigned
if (rootServiceId < 0)
{
throw new Exception(
"Incorrect add-on settings. Root Service ID couldn't be found please review logs and correct this issue."
);
}
// get root service settings
KeyValueBunch rootSettings = ServiceController.GetServiceSettings(
ServiceInfo.SpaceId,
rootServiceId
);
// failed to load root service settings
if (rootSettings == null)
throw new Exception("Unable to load root service settings.");
// add package add-on
PackageAddonInfo addon = new PackageAddonInfo();
// load Package ID
int packageId = 0;
if (!Int32.TryParse(rootSettings[PACKAGE_ID], out packageId))
throw new Exception("Couldn't parse parent service settings: PackageID property. Parent Service ID: " + rootServiceId);
// load Plan ID
int hostingAddon = 0;
if (!Int32.TryParse(ServiceSettings[HOSTING_ADDON], out hostingAddon))
throw new Exception("Couldn't parse service settings: HostingAddon property. Service ID: " + ServiceInfo.ServiceId);
addon.PackageId = packageId;
addon.PlanId = hostingAddon;
addon.Quantity = 1;
addon.StatusId = (int)PackageStatus.Active;
addon.PurchaseDate = DateTime.UtcNow;
PackageResult result = PackageController.AddPackageAddon(addon);
// failed to create package add-on
if (result.Result < 0)
throw new Exception("Unable to add package add-on. Status code: " + result.Result);
// save service settings
PackageAddonID = result.Result.ToString();
}
public void Rollback() {}
#endregion
}
}

View file

@ -0,0 +1,21 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebsitePanel.Products.HostingAddon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("WebsitePanel.Products.HostingAddon")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f7f52492-dda2-440e-a4f8-ec1c535c8c92")]

View file

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{338F816B-BEB4-4F18-9EA1-2EFD35DBA65B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WebsitePanel.Ecommerce.EnterpriseServer</RootNamespace>
<AssemblyName>WebsitePanel.Products.HostingAddon</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\WebsitePanel.EnterpriseServer\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<WarningsAsErrors>618</WarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\WebsitePanel.EnterpriseServer\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<WarningsAsErrors>618</WarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\VersionInfo.cs">
<Link>VersionInfo.cs</Link>
</Compile>
<Compile Include="HostingAddon.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WebsitePanel.EnterpriseServer.Base\WebsitePanel.EnterpriseServer.Base.csproj">
<Project>{C09CE910-F16B-48A1-B2CC-C99B8C1CF775}</Project>
<Name>WebsitePanel.EnterpriseServer.Base</Name>
</ProjectReference>
<ProjectReference Include="..\WebsitePanel.EnterpriseServer\WebsitePanel.EnterpriseServer.csproj">
<Project>{59C7623A-5181-48A5-880A-C9B82B48F589}</Project>
<Name>WebsitePanel.EnterpriseServer</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>