Verified Commit 5e833796 authored by Laurent Sittler's avatar Laurent Sittler ©
Browse files

Add sources

parent 659f7580

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sogeti.SharePoint.WarmUp", "Sogeti.SharePoint.WarmUp\Sogeti.SharePoint.WarmUp.csproj", "{C1827D0F-3724-4AFE-BC00-09862A5C4E38}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C1827D0F-3724-4AFE-BC00-09862A5C4E38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C1827D0F-3724-4AFE-BC00-09862A5C4E38}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C1827D0F-3724-4AFE-BC00-09862A5C4E38}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{C1827D0F-3724-4AFE-BC00-09862A5C4E38}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C1827D0F-3724-4AFE-BC00-09862A5C4E38}.Release|Any CPU.Build.0 = Release|Any CPU
{C1827D0F-3724-4AFE-BC00-09862A5C4E38}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8"?>
<ProjectItem Type="Microsoft.VisualStudio.SharePoint.MappedFolder" SupportedTrustLevels="FullTrust" SupportedDeploymentScopes="Package" xmlns="http://schemas.microsoft.com/VisualStudio/2010/SharePointTools/SharePointProjectItemModel">
<ProjectItemFolder Target="ADMIN" Type="TemplateFile" />
</ProjectItem>
\ No newline at end of file
<%@ Assembly Name="Sogeti.SharePoint.WarmUp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1e24d9f459ee44bd" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" Inherits="Sogeti.SharePoint.WarmUp.Page.WarmUpJobConfigurationPage" MasterPageFile="~/_admin/admin.master" %>
<%@ Import Namespace="Sogeti.SharePoint.WarmUp" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormSection" Src="~/_controltemplates/InputFormSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormControl" Src="~/_controltemplates/InputFormControl.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ButtonSection" Src="~/_controltemplates/ButtonSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ContentDatabaseSection" Src="~/_admin/ContentDatabaseSection.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
<SharePoint:EncodedLiteral ID="EncodedLiteral1" runat="server" Text="Configure aditional URL for WarmUp job" EncodeMethod='HtmlEncode' />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server">
<SharePoint:EncodedLiteral ID="EncodedLiteral2" runat="server" Text="Configure aditional URL for WarmUp job" EncodeMethod='HtmlEncode' />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderPageDescription" runat="server">
<SharePoint:EncodedLiteral ID="EncodedLiteral3" runat="server" Text="WarmUp job enables SharePoint sites to keep awake. This page allows administators to add aditional site URL (SharePoint, ASP.NET or any web site) to keep too." EncodeMethod='HtmlEncodeAllowSimpleTextFormatting' />
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
<script type="text/javascript">
</script>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<div id="SslWarning" style="color: red; display: none"></div>
<table width="100%" class="propertysheet" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="ms-descriptionText">
<asp:Label ID="LabelMessage" runat="server" EnableViewState="False" class="ms-descriptionText" />
</td>
</tr>
<tr>
<td class="ms-error">
<asp:Label ID="LabelErrorMessage" runat="server" EnableViewState="False" />
</td>
</tr>
<tr>
<td class="ms-descriptionText">
<asp:ValidationSummary ID="ValSummary" HeaderText="<%$SPHtmlEncodedResources:spadmin, ValidationSummaryHeaderText%>"
DisplayMode="BulletList" ShowSummary="True" runat="server"></asp:ValidationSummary>
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<wssuc:InputFormSection Title="Additional URLs" runat="server">
<template_description>
<SharePoint:EncodedLiteral ID="EncodedLiteral5" runat="server" text="Add aditionals URL to warm up. Use return to separate each URL. Example : http://mysite/search/result.aspx?k=search" EncodeMethod='HtmlEncodeAllowSimpleTextFormatting'/>
</template_description>
<Template_InputFormControls>
<wssuc:InputFormControl LabelText="Enter additionals URL separate by return :" runat="server">
<Template_Control>
<wssawc:InputFormTextBox class="ms-input" ID="AdditionalUrl" Runat="server" TextMode="MultiLine" Columns="40" Rows="10"/>
</Template_Control>
</wssuc:InputFormControl>
</Template_InputFormControls>
</wssuc:InputFormSection>
<!-- OK/Cancel buttons -->
<wssuc:ButtonSection runat="server">
<template_buttons>
<asp:Button UseSubmitBehavior="false" runat="server" class="ms-ButtonHeightWidth" OnClick="BtnSetAdditionalUrl_Click" Text="<%$Resources:wss,multipages_okbutton_text%>" id="BtnSetAdditionalUrl" accesskey="<%$Resources:wss,okbutton_accesskey%>"/>
</template_buttons>
</wssuc:ButtonSection>
</table>
</asp:Content>
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="Sogeti.SharePoint.WarmUp"
GroupId="TimerJobs"
Location="Microsoft.SharePoint.Administration.Monitoring"
Title="Configure WarmUp"
Description="Configure extra URL for WarmUp job"
Sequence="10000">
<UrlAction Url="/_admin/WarmUpJobConfiguration.aspx"/>
</CustomAction>
</Elements>
<?xml version="1.0" encoding="utf-8"?>
<ProjectItem Type="Microsoft.VisualStudio.SharePoint.GenericElement" DefaultFile="Elements.xml" SupportedTrustLevels="All" SupportedDeploymentScopes="Web, Site, WebApplication, Farm, Package" xmlns="http://schemas.microsoft.com/VisualStudio/2010/SharePointTools/SharePointProjectItemModel">
<Files>
<ProjectItemFile Source="Elements.xml" Target="CustomAction\" Type="ElementManifest" />
</Files>
</ProjectItem>
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using System.Globalization;
namespace Sogeti.SharePoint.WarmUp.Feature
{
/// <summary>
/// EventReceiver for the Sogeti.SharePoint.WarmUp feature
/// </summary>
[Guid("933c1c36-6b35-439f-bd02-cee40860962a")]
public class WarmUpEventReceiver : SPFeatureReceiver
{
/// <summary>
/// Method called by SharePoint when the feature is activated
/// </summary>
/// <param name="properties"></param>
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
// Retreiving current WebApplication
SPWebApplication webApplication = properties.Feature.Parent as SPWebApplication;
// Is this WebApplication is Central Admin ?
if (webApplication.IsAdministrationWebApplication)
{
// Yes, we are on Central Administration. First, we removed exists WarmUpJobDefinition
RemoveJobDefinition(webApplication);
// Deploying new WarmUpJobDefinition
InstallJobDefinition(webApplication);
// Adding custom property
AddProperty(webApplication);
}
else
{
// No, we remove feature from this WebApplication
Guid featureId = properties.Feature.DefinitionId;
webApplication.Features.Remove(featureId, true);
webApplication.Update();
// Throwing an error. This feature is for Central Administration only
throw new SPException(string.Format(CultureInfo.InvariantCulture, "You can activate the feature with ID {0} on the Central Administration Web Application only!", featureId));
}
}
/// <summary>
/// Method called bu SharePoint when the feature was deactivated
/// </summary>
/// <param name="properties"></param>
public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
// Retreiving current WebApplication
SPWebApplication webApplication = properties.Feature.Parent as SPWebApplication;
// Removing WarmUpJobDefinition
RemoveJobDefinition(webApplication);
// Removing custom property
RemoveProperty(webApplication);
}
/// <summary>
/// Install a new WarmUpJobDefinition
/// </summary>
/// <param name="webApplication"></param>
private void InstallJobDefinition(SPWebApplication webApplication)
{
// Creating new Job instance
WarmUpJobDefinition job = new WarmUpJobDefinition(WarmUpInfo.JobDefinitionName, webApplication, SPJobLockType.None);
// Creating Job scheduling
SPMinuteSchedule schedule = new SPMinuteSchedule();
schedule.Interval = 15; // Each 15 minutes
schedule.BeginSecond = 0;
schedule.EndSecond = 59;
job.Schedule = schedule;
// Adding job to JobDefinitions
webApplication.JobDefinitions.Add(job);
}
/// <summary>
/// Search and remove WarmUpJobDefinition if exists
/// </summary>
private void RemoveJobDefinition(SPWebApplication webApplication)
{
// Browsing all JobDefinition
foreach (SPJobDefinition job in webApplication.JobDefinitions)
{
// Current job is a WarmUpJobDefinition ?
if ((job.Name == WarmUpInfo.JobDefinitionName) && (job is WarmUpJobDefinition))
{
// Removing job
job.Delete();
}
}
}
/// <summary>
/// Add the WarmUp custom property
/// </summary>
/// <param name="webApplication"></param>
private void AddProperty(SPWebApplication webApplication)
{
// Does the property already exists ?
if (!webApplication.Properties.ContainsKey(WarmUpInfo.AdditionalUrlPropertyName))
{
// No, we add it and save changes
webApplication.Properties.Add(WarmUpInfo.AdditionalUrlPropertyName, string.Empty);
webApplication.Update();
}
}
/// <summary>
/// Remove the WarmUp property
/// </summary>
/// <param name="webApplication"></param>
private void RemoveProperty(SPWebApplication webApplication)
{
// Does the property exists ?
if (webApplication.Properties.ContainsKey(WarmUpInfo.AdditionalUrlPropertyName))
{
// Yes, we remove it and save changes
webApplication.Properties.Remove(WarmUpInfo.AdditionalUrlPropertyName);
webApplication.Update();
}
}
}
}
using System;
namespace Sogeti.SharePoint.WarmUp.Feature
{
/// <summary>
/// Class providing static information about WarmUp feature
/// </summary>
public class WarmUpInfo
{
/// <summary>
/// Return the name of the WarmUpJobDefinition
/// </summary>
public static string JobDefinitionName
{
get
{
return "SharePoint 2010 WarmUp";
}
}
/// <summary>
/// Name of the custom property containning additionals URL
/// </summary>
public static string AdditionalUrlPropertyName
{
get
{
return "Sogeti.SharePoint.WarmUp.AdditionalURL";
}
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/">
</Feature>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<feature xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="1.0.0.0" Id="bb1e93bb-16fa-47c4-931a-49e05b9e7d4b" activateOnDefault="false" featureId="bb1e93bb-16fa-47c4-931a-49e05b9e7d4b" imageUrl="" receiverAssembly="$SharePoint.Project.AssemblyFullName$" receiverClass="Sogeti.SharePoint.WarmUp.Feature.WarmUpEventReceiver" scope="WebApplication" solutionId="00000000-0000-0000-0000-000000000000" title="WarmUp for SharePoint 2010 by Sogeti" version="" deploymentPath="$SharePoint.Feature.FileNameWithoutExtension$" xmlns="http://schemas.microsoft.com/VisualStudio/2008/SharePointTools/FeatureModel">
<projectItems>
<projectItemReference itemId="c1582987-2efc-41ca-8f77-2dac16a0e58f" />
</projectItems>
</feature>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/">
</Solution>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<package xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="1.0.0.0" Id="6b387908-e70c-4982-906a-d5ca39ad38af" solutionId="6b387908-e70c-4982-906a-d5ca39ad38af" resetWebServer="false" title="WarmUp for SharePoint 2010 by Sogeti" name="Sogeti.SharePoint.WarmUp" xmlns="http://schemas.microsoft.com/VisualStudio/2008/SharePointTools/PackageModel">
<features>
<featureReference itemId="c4582a15-e592-4435-b858-501b6e0e48fa" />
</features>
<projectItems>
<projectItemReference itemId="d9d02740-d38c-4ef2-aaeb-fbfa571f9f8e" />
</projectItems>
</package>
\ No newline at end of file
using System;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.ApplicationPages;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebControls;
using Sogeti.SharePoint.WarmUp.Feature;
namespace Sogeti.SharePoint.WarmUp.Page
{
public partial class WarmUpJobConfigurationPage : OperationsPage
{
/// <summary>
/// Additional URL
/// </summary>
protected InputFormTextBox AdditionalUrl;
/// <summary>
/// OK button
/// </summary>
protected Button BtnSetAdditionalUrl;
/// <summary>
/// Page load
/// </summary>
/// <param name="e"></param>
protected override void OnLoad(EventArgs e)
{
if (!Page.IsPostBack)
{
// We have to initialize le AdditionalUrl with the value contained in the WarmUp custom property
// First, we look if the custom property exists
if (SPContext.Current.Site.WebApplication.Properties.ContainsKey(WarmUpInfo.AdditionalUrlPropertyName))
{
// OK, the property exists. We can initialize InputFormTextBox
AdditionalUrl.Text = SPContext.Current.Site.WebApplication.Properties[WarmUpInfo.AdditionalUrlPropertyName] as string;
}
else
{
// The property should exists, we create it and save changes
SPContext.Current.Site.WebApplication.Properties.Add(WarmUpInfo.AdditionalUrlPropertyName, string.Empty);
SPContext.Current.Site.WebApplication.Update();
}
}
}
/// <summary>
/// Method called when the user validate modifications
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void BtnSetAdditionalUrl_Click(object sender, EventArgs e)
{
using (SPLongOperation operation = new SPLongOperation(this))
{
operation.Begin();
// We save changes
SPContext.Current.Site.WebApplication.Properties[WarmUpInfo.AdditionalUrlPropertyName] = AdditionalUrl.Text;
SPContext.Current.Site.WebApplication.Update();
// Redirect to monitoring home page
operation.End("/monitoring.aspx", SPRedirectFlags.UseSource | SPRedirectFlags.Static, this.Context, null);
}
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
// 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("Sogeti.SharePoint.WarmUp")]
[assembly: AssemblyDescription("SharePoint 2010 Feature for WarmUp")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sogeti.SharePoint.WarmUp")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[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("c1827d0f-3724-4afe-bc00-09862a5c4e38")]
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C1827D0F-3724-4AFE-BC00-09862A5C4E38}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sogeti.SharePoint.WarmUp</RootNamespace>
<AssemblyName>Sogeti.SharePoint.WarmUp</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{BB1F664B-9266-4fd6-B973-E1E44974B511};{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SandboxedSolution>False</SandboxedSolution>
<ActiveDeploymentConfiguration>No Activation</ActiveDeploymentConfiguration>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>Sogeti.SharePoint.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>References\Microsoft.SharePoint.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.ApplicationPages.Administration, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>References\Microsoft.SharePoint.ApplicationPages.Administration.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Feature\WarmUpEventReceiver.cs" />
<Compile Include="Feature\WarmUpInfo.cs" />
<Compile Include="Page\WarmUpJobConfigurationPage.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WarmUpJobDefinition.cs" />
</ItemGroup>
<ItemGroup>
<None Include="ADMIN\SharePointProjectItem.spdata">
<SharePointProjectItemId>{d9d02740-d38c-4ef2-aaeb-fbfa571f9f8e}</SharePointProjectItemId>
</None>
<None Include="CustomAction\SharePointProjectItem.spdata">
<SharePointProjectItemId>{c1582987-2efc-41ca-8f77-2dac16a0e58f}</SharePointProjectItemId>
</None>
<None Include="Features\Sogeti.SharePoint.WarmUp\Sogeti.SharePoint.WarmUp.feature">
<FeatureId>{c4582a15-e592-4435-b858-501b6e0e48fa}</FeatureId>
</None>
<None Include="Package\Package.package">
<PackageId>{6b387908-e70c-4982-906a-d5ca39ad38af}</PackageId>
</None>
<None Include="Package\Package.Template.xml">
<DependentUpon>Package.package</DependentUpon>
</None>
<None Include="Sogeti.SharePoint.snk" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="CustomAction\Elements.xml">
<SubType>Designer</SubType>
</Content>
<Content Include="Features\Sogeti.SharePoint.WarmUp\Sogeti.SharePoint.WarmUp.Template.xml">
<DependentUpon>Sogeti.SharePoint.WarmUp.feature</DependentUpon>
</Content>
<Content Include="ADMIN\WarmUpJobConfiguration.aspx">
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="References\Microsoft.SharePoint.ApplicationPages.Administration.dll" />
<Content Include="References\Microsoft.SharePoint.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets" />
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SharePointSiteUrl>http://brocoli:2012/</SharePointSiteUrl>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>
\ No newline at end of file
using System;
using System.ComponentModel;
using System.Net;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Sogeti.SharePoint.WarmUp.Feature;
using System.Diagnostics;
using System.Threading;
namespace Sogeti.SharePoint.WarmUp
{
/// <summary>
/// SharePoint job for CentralAdmin in charge to WarmUp SharePoint sites
/// </summary>
public class WarmUpJobDefinition : SPJobDefinition
{
// Contructor
public WarmUpJobDefinition()
: base()
{
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="jobName"></param>
/// <param name="webApplication"></param>
/// <param name="targetType"></param>
public WarmUpJobDefinition(string jobName, SPWebApplication webApplication, SPJobLockType targetType)
: base(jobName, webApplication, null, targetType)
{
}
/// <summary>
/// Job display name
/// </summary>
public override string DisplayName
{
get
{
return WarmUpInfo.JobDefinitionName;
}
}
/// <summary>
/// Job description
/// </summary>
public override string Description
{
get
{
return "Keep SharePoint sites and additionals URL awake.";
}
}
/// <summary>
/// Do the Job
/// </summary>
/// <param name="targetInstanceId"></param>
public override void Execute(System.Guid targetInstanceId)
{
// retreiving current SPWebService
SPWebService webService = SPWebService.ContentService;
SPWebApplicationCollection webApplications = webService.WebApplications;