Skip to content

Commit

Permalink
Merge pull request #43 from Sitefinity/upgrade151
Browse files Browse the repository at this point in the history
Release v.15.1.8300.0
  • Loading branch information
nader-dab authored Oct 29, 2024
2 parents 6058647 + 51ce21c commit 91a25ff
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 544 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Sitefinity's Amazon S3 Blob Storage Provider
Sitefinity's Amazon S3 Blob Storage Provider
===================================================

Sitefinity's Amazon S3 Blob Storage Provider is an implementation of a cloud blob storage provider, which stores the binary blob data of Sitefinity's library items on Amazon's Simple Storage Service (S3). This document describes how to use the provider.
Expand Down
25 changes: 25 additions & 0 deletions Telerik.Sitefinity.Amazon/BlobStorage/AmazonBlobStorageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,31 @@ public override bool BlobExists(IBlobContentLocation location)
return false;
}

// <inheritdoc/>
public override bool TestConnection(out Exception error)
{
try
{
ListObjectsRequest request = new ListObjectsRequest();
request.BucketName = this.bucketName;

ListObjectsResponse response = transferUtility.S3Client.ListObjects(request);
if (response.HttpStatusCode != System.Net.HttpStatusCode.OK)
{
error = new Exception(string.Format("Unexpected status code when loading objects from a bucket: {0}", response.HttpStatusCode));
return false;
}
}
catch (Exception ex)
{
error = ex;
return false;
}

error = null;
return true;
}

#endregion

#region Properties
Expand Down
13 changes: 13 additions & 0 deletions Telerik.Sitefinity.Amazon/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project>
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<WarningLevel>0</WarningLevel>
</PropertyGroup>

<!-- Telerik Data Access related variables -->
<PropertyGroup>
<Use64BitEnhancer>true</Use64BitEnhancer>
<EnhancerVerboseMode>3</EnhancerVerboseMode>
</PropertyGroup>
</Project>
9 changes: 9 additions & 0 deletions Telerik.Sitefinity.Amazon/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Telerik.Sitefinity.Core" Version="15.1.8300" />
<PackageVersion Include="AWSSDK.S3" Version="3.7.300.2" />
</ItemGroup>
</Project>
65 changes: 65 additions & 0 deletions Telerik.Sitefinity.Amazon/Initializer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using Telerik.Microsoft.Practices.Unity;
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.Amazon.BlobStorage;
using Telerik.Sitefinity.Configuration;
using Telerik.Sitefinity.Modules.Libraries;
using Telerik.Sitefinity.Modules.Libraries.Configuration;

namespace Telerik.Sitefinity.Amazon
{
/// <summary>
/// Registers Amazon blob storage provider.
/// </summary>
public static class Initializer
{
/// <summary>
/// Attach to ObjectFactory_RegisteringIoCTypes event.
/// </summary>
public static void Initialize()
{
ObjectFactory.RegisteringIoCTypes += ObjectFactory_RegisteringIoCTypes;
}

private static void ObjectFactory_RegisteringIoCTypes(object sender, EventArgs e)
{
ObjectFactory.Container.RegisterType(typeof(IBlobStorageConfiguration), typeof(AmazonBlobStorageConfiguration), typeof(AmazonBlobStorageConfiguration).Name);
}

/// <summary>
/// Register Amazon blob strorage providers and types
/// </summary>
class AmazonBlobStorageConfiguration : IBlobStorageConfiguration
{
public IEnumerable<BlobStorageTypeConfigElement> GetProviderTypeConfigElements(ConfigElement parent)
{
var providerTypes = new List<BlobStorageTypeConfigElement>();

providerTypes.Add(new BlobStorageTypeConfigElement(parent)
{
Name = "Amazon",
ProviderType = typeof(AmazonBlobStorageProvider),
Title = "Amazon S3",
Parameters = new NameValueCollection()
{
{ AmazonBlobStorageProvider.AccessKeyIdKey, string.Empty },
{ AmazonBlobStorageProvider.SecretKeyKey, "#sf_Secret" },
{ AmazonBlobStorageProvider.BucketNameKey, string.Empty },
{ AmazonBlobStorageProvider.RegionEndpointKey, string.Empty },
{ AmazonBlobStorageProvider.UrlSchemeKey, string.Empty }
}
});

return providerTypes;
}

public IEnumerable<DataProviderSettings> GetProviderConfigElements(ConfigElement parent)
{
return new List<DataProviderSettings>();
}
}
}
}
15 changes: 15 additions & 0 deletions Telerik.Sitefinity.Amazon/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="true" />
</packageRestore>
<packageSources>
<clear />
<add key="nuget.sitefinity.com" value="https://nuget.sitefinity.com/nuget" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
19 changes: 2 additions & 17 deletions Telerik.Sitefinity.Amazon/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Web;

// 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("Telerik.Sitefinity.Amazon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Progress")]
[assembly: AssemblyProduct("Progress Sitefinity CMS")]
[assembly: AssemblyCopyright("Copyright © 2005-2023 Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved.")]
[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
Expand All @@ -21,15 +17,4 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fdf5367c-2b3f-48fb-a171-92f9ab3bf155")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("14.3.8000.0")]
[assembly: AssemblyFileVersion("14.3.8000.0")]
[assembly: PreApplicationStartMethod(typeof(Telerik.Sitefinity.Amazon.Initializer), "Initialize")]
Loading

0 comments on commit 91a25ff

Please sign in to comment.