Merge pull request #105 from djechelon/master
Spring.Net.Velocity.Castle
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.30723.0
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F04753EF-7A1B-4837-AB63-8C0821E8155D}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
@@ -105,6 +105,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate4.Tes
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate4.Integration.Tests.2010", "test\Spring\Spring.Data.NHibernate4.Integration.Tests\Spring.Data.NHibernate4.Integration.Tests.2010.csproj", "{46F8B5E9-ABCF-4306-BC05-FF05B0FAC151}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Template.Velocity.Castle.2010", "src\Spring\Spring.Template.Velocity.Castle\Spring.Template.Velocity.Castle.2010.csproj", "{250601C0-A4AC-41FE-B484-51A9B0D5473D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Template.Velocity.Castle.Tests.2010", "test\Spring\Spring.Template.Velocity.Castle.Tests\Spring.Template.Velocity.Castle.Tests.2010.csproj", "{8D6ED392-8A1F-41C0-A765-22CF384EDEA1}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests", "test\Spring\Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests\Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests.csproj", "{DE276F7C-4564-49EC-AABC-B964EC3D1626}"
|
||||
EndProject
|
||||
Global
|
||||
@@ -557,6 +560,26 @@ Global
|
||||
{46F8B5E9-ABCF-4306-BC05-FF05B0FAC151}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{46F8B5E9-ABCF-4306-BC05-FF05B0FAC151}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{46F8B5E9-ABCF-4306-BC05-FF05B0FAC151}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{250601C0-A4AC-41FE-B484-51A9B0D5473D}.Debug|.NET.ActiveCfg = Debug|Any CPU
|
||||
{250601C0-A4AC-41FE-B484-51A9B0D5473D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{250601C0-A4AC-41FE-B484-51A9B0D5473D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{250601C0-A4AC-41FE-B484-51A9B0D5473D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{250601C0-A4AC-41FE-B484-51A9B0D5473D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{250601C0-A4AC-41FE-B484-51A9B0D5473D}.Release|.NET.ActiveCfg = Release|Any CPU
|
||||
{250601C0-A4AC-41FE-B484-51A9B0D5473D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{250601C0-A4AC-41FE-B484-51A9B0D5473D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{250601C0-A4AC-41FE-B484-51A9B0D5473D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{250601C0-A4AC-41FE-B484-51A9B0D5473D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{8D6ED392-8A1F-41C0-A765-22CF384EDEA1}.Debug|.NET.ActiveCfg = Debug|Any CPU
|
||||
{8D6ED392-8A1F-41C0-A765-22CF384EDEA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8D6ED392-8A1F-41C0-A765-22CF384EDEA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8D6ED392-8A1F-41C0-A765-22CF384EDEA1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{8D6ED392-8A1F-41C0-A765-22CF384EDEA1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{8D6ED392-8A1F-41C0-A765-22CF384EDEA1}.Release|.NET.ActiveCfg = Release|Any CPU
|
||||
{8D6ED392-8A1F-41C0-A765-22CF384EDEA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8D6ED392-8A1F-41C0-A765-22CF384EDEA1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8D6ED392-8A1F-41C0-A765-22CF384EDEA1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{8D6ED392-8A1F-41C0-A765-22CF384EDEA1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{DE276F7C-4564-49EC-AABC-B964EC3D1626}.Debug|.NET.ActiveCfg = Debug|Any CPU
|
||||
{DE276F7C-4564-49EC-AABC-B964EC3D1626}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DE276F7C-4564-49EC-AABC-B964EC3D1626}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
|
||||
42
src/Spring/Spring.Template.Velocity.Castle/AssemblyInfo.cs
Normal file
42
src/Spring/Spring.Template.Velocity.Castle/AssemblyInfo.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: AssemblyTitle("Spring.Template.Velocity.Castle")]
|
||||
[assembly: AssemblyDescription("Castle NVelocity template engine integration for Spring.NET")]
|
||||
|
||||
//
|
||||
// Security Permissions
|
||||
//
|
||||
// we need full, unrestricted access to reflection metadata...
|
||||
//[assembly: ReflectionPermission(SecurityAction.RequestMinimum, Unrestricted = true)]
|
||||
//[assembly: AssemblyKeyFile(@"C:\users\aseovic\projects\OpenSource\Spring.Net\Spring.Net.PrivateKey.keys")]
|
||||
//[assembly: AssemblyKeyFile(@"C:\projects\Spring.Net\Spring.Net.snk")]
|
||||
|
||||
#if !NET_4_0
|
||||
[assembly: AllowPartiallyTrustedCallers]
|
||||
|
||||
[assembly: SecurityCritical]
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{250601C0-A4AC-41FE-B484-51A9B0D5473D}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring</RootNamespace>
|
||||
<AssemblyName>Spring.Template.Velocity.Castle</AssemblyName>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<PublishUrl>http://localhost/Spring.Template.Velocity.Castle/</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
<UpdateEnabled>true</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>true</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2010\Spring.Template.Velocity.Castle\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NET_4_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>..\..\..\build\VS.NET.2010\Spring.Template.Velocity.Castle\Debug\Spring.Template.Velocity.xml</DocumentationFile>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2010\Spring.Template.Velocity.Castle\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NET_4_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DocumentationFile>..\..\..\build\VS.NET.2010\Spring.Template.Velocity.Castle\Release\Spring.Template.Velocity.XML</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Common.Logging">
|
||||
<HintPath>..\..\..\packages\Common.Logging.3.0.0\lib\net40\Common.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Common.Logging.Core">
|
||||
<HintPath>..\..\..\packages\Common.Logging.Core.3.0.0\lib\net40\Common.Logging.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NVelocity">
|
||||
<HintPath>..\..\..\packages\Castle.NVelocity.1.1.1\lib\net40\NVelocity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\CommonAssemblyInfo.cs">
|
||||
<Link>CommonAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Template.Velocity\Template\Velocity\CommonsLoggingLogSystem.cs">
|
||||
<Link>Template\Velocity\CommonsLoggingLogSystem.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Template.Velocity\Template\Velocity\VelocityConstants.cs">
|
||||
<Link>Template\Velocity\VelocityConstants.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Template.Velocity\Template\Velocity\VelocityEngineFactory.cs">
|
||||
<Link>Template\Velocity\VelocityEngineFactory.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Template.Velocity\Template\Velocity\VelocityEngineFactoryObject.cs">
|
||||
<Link>Template\Velocity\VelocityEngineFactoryObject.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Template.Velocity\Template\Velocity\VelocityEngineUtils.cs">
|
||||
<Link>Template\Velocity\VelocityEngineUtils.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="Template\Velocity\Config\TemplateNamespaceParser.cs" />
|
||||
<Compile Include="Template\Velocity\SpringResourceLoader.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\Spring.Template.Velocity\Template\Velocity\Config\spring-nvelocity-1.3.xsd">
|
||||
<Link>Template\Velocity\Config\spring-nvelocity-1.3.xsd</Link>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Spring.Core\Spring.Core.2010.csproj">
|
||||
<Project>{710961a3-0df4-49e4-a26e-f5b9c044ac84}</Project>
|
||||
<Name>Spring.Core.2010</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>Questo progetto fa riferimento a uno o più pacchetti NuGet che non sono presenti sul computer in uso. Abilitare il ripristino dei pacchetti NuGet per scaricarli. Per ulteriori informazioni, visitare http://go.microsoft.com/fwlink/?LinkID=322105. Il file mancante è {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
|
||||
</Target>
|
||||
<!-- 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>
|
||||
@@ -0,0 +1,473 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
|
||||
using NVelocity.Runtime;
|
||||
|
||||
using Spring.Core.TypeResolution;
|
||||
using Spring.Objects;
|
||||
using Spring.Objects.Factory.Config;
|
||||
using Spring.Objects.Factory.Support;
|
||||
using Spring.Objects.Factory.Xml;
|
||||
using Spring.Util;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Template.Velocity.Config {
|
||||
/// <summary>
|
||||
/// Implementation of the custom configuration parser for template configurations
|
||||
/// based on
|
||||
/// <see cref="ObjectsNamespaceParser"/>
|
||||
/// </summary>
|
||||
/// <author>Erez Mazor</author>
|
||||
/// <see cref="ObjectsNamespaceParser"/>
|
||||
[
|
||||
NamespaceParser(
|
||||
Namespace = "http://www.springframework.net/nvelocity",
|
||||
SchemaLocationAssemblyHint = typeof(TemplateNamespaceParser),
|
||||
SchemaLocation = "/Spring.Template.Velocity.Config/spring-nvelocity-1.3.xsd")
|
||||
]
|
||||
public class TemplateNamespaceParser : ObjectsNamespaceParser {
|
||||
private const string TemplateTypePrefix = "template: ";
|
||||
|
||||
static TemplateNamespaceParser() {
|
||||
TypeRegistry.RegisterType(TemplateTypePrefix + TemplateDefinitionConstants.NVelocityElement, typeof(VelocityEngineFactoryObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TemplateNamespaceParser"/> class.
|
||||
/// </summary>
|
||||
public TemplateNamespaceParser() {
|
||||
}
|
||||
|
||||
/// <see cref="INamespaceParser"/>
|
||||
public override IObjectDefinition ParseElement(XmlElement element, ParserContext parserContext) {
|
||||
string name = element.GetAttribute(ObjectDefinitionConstants.IdAttribute);
|
||||
IConfigurableObjectDefinition templateDefinition = ParseTemplateDefinition(element, parserContext);
|
||||
if (!StringUtils.HasText(name)) {
|
||||
name = ObjectDefinitionReaderUtils.GenerateObjectName(templateDefinition, parserContext.Registry);
|
||||
}
|
||||
parserContext.Registry.RegisterObjectDefinition(name, templateDefinition);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse a template definition from the templating namespace
|
||||
/// </summary>
|
||||
/// <param name="element">the root element defining the templating object</param>
|
||||
/// <param name="parserContext">the parser context</param>
|
||||
/// <returns></returns>
|
||||
private IConfigurableObjectDefinition ParseTemplateDefinition(XmlElement element, ParserContext parserContext) {
|
||||
switch (element.LocalName) {
|
||||
case TemplateDefinitionConstants.NVelocityElement:
|
||||
return ParseNVelocityEngine(element, parserContext);
|
||||
default:
|
||||
throw new ArgumentException(string.Format("undefined element for templating namespace: {0}", element.LocalName));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses the object definition for the engine object, configures a single NVelocity template engine based
|
||||
/// on the element definitions.
|
||||
/// </summary>
|
||||
/// <param name="element">the root element defining the velocity engine</param>
|
||||
/// <param name="parserContext">the parser context</param>
|
||||
private IConfigurableObjectDefinition ParseNVelocityEngine(XmlElement element, ParserContext parserContext) {
|
||||
string typeName = GetTypeName(element);
|
||||
IConfigurableObjectDefinition configurableObjectDefinition = parserContext.ReaderContext.ObjectDefinitionFactory.CreateObjectDefinition(
|
||||
typeName, null, parserContext.ReaderContext.Reader.Domain);
|
||||
|
||||
string preferFileSystemAccess = GetAttributeValue(element, TemplateDefinitionConstants.AttributePreferFileSystemAccess);
|
||||
string overrideLogging = GetAttributeValue(element, TemplateDefinitionConstants.AttributeOverrideLogging);
|
||||
string configFile = GetAttributeValue(element, TemplateDefinitionConstants.AttributeConfigFile);
|
||||
|
||||
MutablePropertyValues objectDefinitionProperties = new MutablePropertyValues();
|
||||
if (StringUtils.HasText(preferFileSystemAccess)) {
|
||||
objectDefinitionProperties.Add(TemplateDefinitionConstants.PropertyPreferFileSystemAccess, preferFileSystemAccess);
|
||||
}
|
||||
|
||||
if (StringUtils.HasText(overrideLogging)) {
|
||||
objectDefinitionProperties.Add(TemplateDefinitionConstants.PropertyOverrideLogging, overrideLogging);
|
||||
}
|
||||
|
||||
if (StringUtils.HasText(configFile)) {
|
||||
objectDefinitionProperties.Add(TemplateDefinitionConstants.PropertyConfigFile, configFile);
|
||||
}
|
||||
|
||||
XmlNodeList childElements = element.ChildNodes;
|
||||
if (childElements.Count > 0) {
|
||||
ParseChildDefinitions(childElements, parserContext, objectDefinitionProperties);
|
||||
}
|
||||
configurableObjectDefinition.PropertyValues = objectDefinitionProperties;
|
||||
return configurableObjectDefinition;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses child element definitions for the NVelocity engine. Typically resource loaders and locally defined properties are parsed here
|
||||
/// </summary>
|
||||
/// <param name="childElements">the XmlNodeList representing the child configuration of the root NVelocity engine element</param>
|
||||
/// <param name="parserContext">the parser context</param>
|
||||
/// <param name="objectDefinitionProperties">the MutablePropertyValues used to configure this object</param>
|
||||
private void ParseChildDefinitions(XmlNodeList childElements, ParserContext parserContext, MutablePropertyValues objectDefinitionProperties) {
|
||||
IDictionary<string, object> properties = new Dictionary<string, object>();
|
||||
|
||||
foreach (XmlElement element in childElements) {
|
||||
switch (element.LocalName) {
|
||||
case TemplateDefinitionConstants.ElementResourceLoader:
|
||||
ParseResourceLoader(element, objectDefinitionProperties, properties);
|
||||
break;
|
||||
case TemplateDefinitionConstants.ElementNVelocityProperties:
|
||||
ParseNVelocityProperties(element, parserContext, properties);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (properties.Count > 0) {
|
||||
objectDefinitionProperties.Add(TemplateDefinitionConstants.PropertyVelocityProperties, properties);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the NVelocity resource loader definitions from the xml definition
|
||||
/// </summary>
|
||||
/// <param name="element">the root resource loader element</param>
|
||||
/// <param name="objectDefinitionProperties">the MutablePropertyValues used to configure this object</param>
|
||||
/// <param name="properties">the properties used to initialize the velocity engine</param>
|
||||
private void ParseResourceLoader(XmlElement element, MutablePropertyValues objectDefinitionProperties, IDictionary<string, object> properties) {
|
||||
string caching = GetAttributeValue(element, TemplateDefinitionConstants.AttributeTemplateCaching);
|
||||
string defaultCacheSize = GetAttributeValue(element, TemplateDefinitionConstants.AttributeDefaultCacheSize);
|
||||
string modificationCheckInterval = GetAttributeValue(element, TemplateDefinitionConstants.AttributeModificationCheckInterval);
|
||||
|
||||
if (!string.IsNullOrEmpty(defaultCacheSize)) {
|
||||
properties.Add(RuntimeConstants.RESOURCE_MANAGER_DEFAULTCACHE_SIZE, defaultCacheSize);
|
||||
}
|
||||
|
||||
XmlNodeList loaderElements = element.ChildNodes;
|
||||
switch (loaderElements[0].LocalName) {
|
||||
case VelocityConstants.File:
|
||||
AppendFileLoaderProperties(loaderElements, properties);
|
||||
AppendResourceLoaderGlobalProperties(properties, VelocityConstants.File, caching,
|
||||
modificationCheckInterval);
|
||||
break;
|
||||
case VelocityConstants.Assembly:
|
||||
AppendAssemblyLoaderProperties(loaderElements, properties);
|
||||
AppendResourceLoaderGlobalProperties(properties, VelocityConstants.Assembly, caching, null);
|
||||
break;
|
||||
case TemplateDefinitionConstants.Spring:
|
||||
AppendResourceLoaderPaths(loaderElements, objectDefinitionProperties);
|
||||
AppendResourceLoaderGlobalProperties(properties, TemplateDefinitionConstants.Spring, caching, null);
|
||||
break;
|
||||
case TemplateDefinitionConstants.Custom:
|
||||
XmlElement firstElement = (XmlElement)loaderElements.Item(0);
|
||||
AppendCustomLoaderProperties(firstElement, properties);
|
||||
AppendResourceLoaderGlobalProperties(properties, firstElement.LocalName, caching, modificationCheckInterval);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException(string.Format("undefined element for resource loadre type: {0}", element.LocalName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Set the caching and modification interval checking properties of a resource loader of a given type
|
||||
/// </summary>
|
||||
/// <param name="properties">the properties used to initialize the velocity engine</param>
|
||||
/// <param name="type">type of the resource loader</param>
|
||||
/// <param name="caching">caching flag</param>
|
||||
/// <param name="modificationInterval">modification interval value</param>
|
||||
private void AppendResourceLoaderGlobalProperties(IDictionary<string, object> properties, string type, string caching, string modificationInterval) {
|
||||
AppendResourceLoaderGlobalProperty(properties, type,
|
||||
TemplateDefinitionConstants.PropertyResourceLoaderCaching,
|
||||
Convert.ToBoolean(caching));
|
||||
AppendResourceLoaderGlobalProperty
|
||||
(properties, type, TemplateDefinitionConstants.PropertyResourceLoaderModificationCheckInterval, Convert.ToInt64(modificationInterval));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set global velocity resource loader properties (caching, modification interval etc.)
|
||||
/// </summary>
|
||||
/// <param name="properties">the properties used to initialize the velocity engine</param>
|
||||
/// <param name="type">the type of resource loader</param>
|
||||
/// <param name="property">the suffix property</param>
|
||||
/// <param name="value">the value of the property</param>
|
||||
private void AppendResourceLoaderGlobalProperty(IDictionary<string, object> properties, string type, string property, object value) {
|
||||
if (null != value) {
|
||||
properties.Add(type + VelocityConstants.Separator + property, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a nvelocity file based resource loader by setting the required properties
|
||||
/// </summary>
|
||||
/// <param name="elements">a list of nv:file elements defining the paths to template files</param>
|
||||
/// <param name="properties">the properties used to initialize the velocity engine</param>
|
||||
private void AppendFileLoaderProperties(XmlNodeList elements, IDictionary<string, object> properties) {
|
||||
IList<string> paths = new List<string>(elements.Count);
|
||||
foreach (XmlElement element in elements)
|
||||
{
|
||||
paths.Add(GetAttributeValue(element, VelocityConstants.Path));
|
||||
}
|
||||
properties.Add(RuntimeConstants.RESOURCE_LOADER, VelocityConstants.File);
|
||||
properties.Add(getResourceLoaderProperty(VelocityConstants.File, VelocityConstants.Class), TemplateDefinitionConstants.FileResourceLoaderClass);
|
||||
properties.Add(getResourceLoaderProperty(VelocityConstants.File, VelocityConstants.Path), StringUtils.CollectionToCommaDelimitedString(paths));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a nvelocity assembly based resource loader by setting the required properties
|
||||
/// </summary>
|
||||
/// <param name="elements">a list of nv:assembly elements defining the assemblies</param>
|
||||
/// <param name="properties">the properties used to initialize the velocity engine</param>
|
||||
private void AppendAssemblyLoaderProperties(XmlNodeList elements, IDictionary<string, object> properties) {
|
||||
IList<string> assemblies = new List<string>(elements.Count);
|
||||
foreach (XmlElement element in elements) {
|
||||
assemblies.Add(GetAttributeValue(element, VelocityConstants.Name));
|
||||
}
|
||||
properties.Add(RuntimeConstants.RESOURCE_LOADER, VelocityConstants.Assembly);
|
||||
properties.Add(getResourceLoaderProperty(VelocityConstants.Assembly, VelocityConstants.Class), TemplateDefinitionConstants.AssemblyResourceLoaderClass);
|
||||
properties.Add(getResourceLoaderProperty(VelocityConstants.Assembly, VelocityConstants.Assembly), StringUtils.CollectionToCommaDelimitedString(assemblies));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a spring resource loader by setting the ResourceLoaderPaths of the
|
||||
/// engine factory (the resource loader itself will be created internally either as
|
||||
/// spring or as file resource loader based on the value of prefer-file-system-access
|
||||
/// attribute).
|
||||
/// </summary>
|
||||
/// <param name="elements">list of resource loader path elements</param>
|
||||
/// <param name="objectDefinitionProperties">the MutablePropertyValues to set the property for the engine factory</param>
|
||||
private void AppendResourceLoaderPaths(XmlNodeList elements, MutablePropertyValues objectDefinitionProperties) {
|
||||
IList<string> paths = new List<string>();
|
||||
foreach (XmlElement element in elements) {
|
||||
string path = GetAttributeValue(element, TemplateDefinitionConstants.AttributeUri);
|
||||
paths.Add(path);
|
||||
}
|
||||
objectDefinitionProperties.Add(TemplateDefinitionConstants.PropertyResourceLoaderPaths, paths);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a custom resource loader from an nv:custom element
|
||||
/// generates the 4 required nvelocity props for a resource loader (name, description, class and path).
|
||||
/// </summary>
|
||||
/// <param name="element">the nv:custom xml definition element</param>
|
||||
/// <param name="properties">the properties used to initialize the velocity engine</param>
|
||||
private void AppendCustomLoaderProperties(XmlElement element, IDictionary<string, object> properties) {
|
||||
string name = GetAttributeValue(element, VelocityConstants.Name);
|
||||
string description = GetAttributeValue(element, VelocityConstants.Description);
|
||||
string type = GetAttributeValue(element, VelocityConstants.Type);
|
||||
string path = GetAttributeValue(element, VelocityConstants.Path);
|
||||
properties.Add(RuntimeConstants.RESOURCE_LOADER, name);
|
||||
properties.Add(getResourceLoaderProperty(name, VelocityConstants.Description), description);
|
||||
properties.Add(getResourceLoaderProperty(name, VelocityConstants.Class), type.Replace(',', ';'));
|
||||
properties.Add(getResourceLoaderProperty(name, VelocityConstants.Path), path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses the nvelocity properties map using <code>ObjectNamespaceParserHelper</code>
|
||||
/// and appends it to the properties dictionary
|
||||
/// </summary>
|
||||
/// <param name="element">root element of the map element</param>
|
||||
/// <param name="parserContext">the parser context</param>
|
||||
/// <param name="properties">the properties used to initialize the velocity engine</param>
|
||||
private void ParseNVelocityProperties(XmlElement element, ParserContext parserContext, IDictionary<string, object> properties) {
|
||||
IDictionary parsedProperties = ParseDictionaryElement(element,
|
||||
TemplateDefinitionConstants.ElementNVelocityProperties, parserContext);
|
||||
foreach (DictionaryEntry entry in parsedProperties) {
|
||||
properties.Add(Convert.ToString(entry.Key), entry.Value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the object type for the specified element.
|
||||
/// </summary>
|
||||
/// <param name="element">The element.</param>
|
||||
/// <returns>The name of the object type.</returns>
|
||||
private string GetTypeName(XmlElement element) {
|
||||
string typeName = element.GetAttribute(ObjectDefinitionConstants.TypeAttribute);
|
||||
if (StringUtils.IsNullOrEmpty(typeName)) {
|
||||
return TemplateTypePrefix + element.LocalName;
|
||||
}
|
||||
return typeName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructs an nvelocity style resource loader property in the format:
|
||||
/// prefix.resource.loader.suffix
|
||||
/// </summary>
|
||||
/// <param name="type">the prefix</param>
|
||||
/// <param name="suffix">the suffix</param>
|
||||
/// <returns>a concatenated string like: prefix.resource.loader.suffix</returns>
|
||||
public static string getResourceLoaderProperty(string type, string suffix) {
|
||||
return type + VelocityConstants.Separator + RuntimeConstants.RESOURCE_LOADER + VelocityConstants.Separator +
|
||||
suffix;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is overriden from ObjectsNamespaceParser since when invoked on
|
||||
/// sub-elements from the objets namespace (e.g., objects:objectMap for nvelocity
|
||||
/// property map) the <code>element.SelectNodes</code> fails because it is in
|
||||
/// the nvelocity custom namespace and not the object's namespace (http://www.springframwork.net)
|
||||
/// to amend this the object's namespace is added to the provided XmlNamespaceManager
|
||||
/// </summary>
|
||||
///<param name="element"> The element to be searched in. </param>
|
||||
/// <param name="childElementName"> The name of the child nodes to look for.
|
||||
/// </param>
|
||||
/// <returns> The child <see cref="System.Xml.XmlNode"/>s of the supplied
|
||||
/// <paramref name="element"/> with the supplied <paramref name="childElementName"/>.
|
||||
/// </returns>
|
||||
/// <see cref="ObjectsNamespaceParser"/>
|
||||
[Obsolete("not used anymore - ObjectsNamespaceParser will be dropped with 2.x, use ObjectDefinitionParserHelper instead")]
|
||||
protected override XmlNodeList SelectNodes(XmlElement element, string childElementName) {
|
||||
XmlNamespaceManager nsManager = new XmlNamespaceManager(new NameTable());
|
||||
nsManager.AddNamespace(GetNamespacePrefix(element), element.NamespaceURI);
|
||||
nsManager.AddNamespace(GetNamespacePrefix(element), Namespace);
|
||||
return element.SelectNodes(GetNamespacePrefix(element) + ":" + childElementName, nsManager);
|
||||
}
|
||||
|
||||
private string GetNamespacePrefix(XmlElement element) {
|
||||
return StringUtils.HasText(element.Prefix) ? element.Prefix : "spring";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region Element & Attribute Name Constants
|
||||
|
||||
/// <summary>
|
||||
/// Template definition constants
|
||||
/// </summary>
|
||||
public class TemplateDefinitionConstants {
|
||||
/// <summary>
|
||||
/// Engine element definition
|
||||
/// </summary>
|
||||
public const string NVelocityElement = "engine";
|
||||
|
||||
/// <summary>
|
||||
/// Spring resource loader element definition
|
||||
/// </summary>
|
||||
public const string Spring = "spring";
|
||||
|
||||
/// <summary>
|
||||
/// Custom resource loader element definition
|
||||
/// </summary>
|
||||
public const string Custom = "custom";
|
||||
|
||||
/// <summary>
|
||||
/// uri attribute of the spring element
|
||||
/// </summary>
|
||||
public const string AttributeUri = "uri";
|
||||
|
||||
/// <summary>
|
||||
/// prefer-file-system-access attribute of the engine factory
|
||||
/// </summary>
|
||||
public const string AttributePreferFileSystemAccess = "prefer-file-system-access";
|
||||
|
||||
/// <summary>
|
||||
/// config-file attribute of the engine factory
|
||||
/// </summary>
|
||||
public const string AttributeConfigFile = "config-file";
|
||||
|
||||
/// <summary>
|
||||
/// override-logging attribute of the engine factory
|
||||
/// </summary>
|
||||
public const string AttributeOverrideLogging = "override-logging";
|
||||
|
||||
/// <summary>
|
||||
/// template-caching attribute of the nvelocity engine
|
||||
/// </summary>
|
||||
public const string AttributeTemplateCaching = "template-caching";
|
||||
|
||||
/// <summary>
|
||||
/// default-cache-size attribute of the nvelocity engine resource manager
|
||||
/// </summary>
|
||||
public const string AttributeDefaultCacheSize = "default-cache-size";
|
||||
|
||||
/// <summary>
|
||||
/// modification-check-interval attribute of the nvelocity engine resource loader
|
||||
/// </summary>
|
||||
public const string AttributeModificationCheckInterval = "modification-check-interval";
|
||||
|
||||
/// <summary>
|
||||
/// resource loader element
|
||||
/// </summary>
|
||||
public const string ElementResourceLoader = "resource-loader";
|
||||
|
||||
/// <summary>
|
||||
/// nvelocity propeties element (map)
|
||||
/// </summary>
|
||||
public const string ElementNVelocityProperties = "nvelocity-properties";
|
||||
|
||||
/// <summary>
|
||||
/// PreferFileSystemAccess property of the engine factory
|
||||
/// </summary>
|
||||
public const string PropertyPreferFileSystemAccess = "PreferFileSystemAccess";
|
||||
|
||||
/// <summary>
|
||||
/// OverrideLogging property of the engine factory
|
||||
/// </summary>
|
||||
public const string PropertyOverrideLogging = "OverrideLogging";
|
||||
|
||||
/// <summary>
|
||||
/// ConfigLocation property of the engine factory
|
||||
/// </summary>
|
||||
public const string PropertyConfigFile = "ConfigLocation";
|
||||
|
||||
/// <summary>
|
||||
/// ResourceLoaderPaths property of the engine factory
|
||||
/// </summary>
|
||||
public const string PropertyResourceLoaderPaths = "ResourceLoaderPaths";
|
||||
|
||||
/// <summary>
|
||||
/// VelocityProperties property of the engine factory
|
||||
/// </summary>
|
||||
public const string PropertyVelocityProperties = "VelocityProperties";
|
||||
|
||||
/// <summary>
|
||||
/// resource.loader.cache property of the resource loader configuration
|
||||
/// </summary>
|
||||
public const string PropertyResourceLoaderCaching = "resource.loader.cache";
|
||||
|
||||
/// <summary>
|
||||
/// resource.loader.modificationCheckInterval property of the resource loader configuration
|
||||
/// </summary>
|
||||
public const string PropertyResourceLoaderModificationCheckInterval = "resource.loader.modificationCheckInterval";
|
||||
|
||||
/// <summary>
|
||||
/// the type used for file resource loader
|
||||
/// </summary>
|
||||
public const string FileResourceLoaderClass = "NVelocity.Runtime.Resource.Loader.FileResourceLoader; NVelocity";
|
||||
|
||||
/// <summary>
|
||||
/// the type used for assembly resource loader
|
||||
/// </summary>
|
||||
public const string AssemblyResourceLoaderClass = "NVelocity.Runtime.Resource.Loader.AssemblyResourceLoader; NVelocity";
|
||||
|
||||
/// <summary>
|
||||
/// the type used for spring resource loader
|
||||
/// </summary>
|
||||
public const string SpringResourceLoaderClass = "Spring.Template.Velocity.SpringResourceLoader; Spring.Template.Velocity.Castle";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Common.Logging;
|
||||
using Commons.Collections;
|
||||
using NVelocity.Runtime.Resource;
|
||||
using NVelocity.Runtime.Resource.Loader;
|
||||
using Spring.Core.IO;
|
||||
|
||||
namespace Spring.Template.Velocity
|
||||
{
|
||||
/// <summary>
|
||||
/// NVelocity's abstract ResourceLoader extension which serves
|
||||
/// as an adapter that loads templates via a Spring IResourceLoader.
|
||||
///
|
||||
/// <br/>
|
||||
/// Used by VelocityEngineFactory for any resource loader path that
|
||||
/// cannot be resolved to a File or an Assembly or for
|
||||
/// implementations which rely on spring's IResourceLoader
|
||||
/// mechanism.
|
||||
///
|
||||
/// <br/>
|
||||
/// <b>Important</b>: this loader does not allow for modification detection.
|
||||
///<br/>
|
||||
/// Expects "spring.resource.loader" (IResourceLoader implementations)
|
||||
/// and "spring.resource.loader.path" application attributes in the
|
||||
/// NVelocity runtime.
|
||||
/// </summary>
|
||||
/// <see cref="VelocityEngineFactory.ResourceLoaderPath"/>
|
||||
/// <see cref="IResourceLoader"/>
|
||||
/// <see cref="FileResourceLoader"/>
|
||||
/// <see cref="ResourceLoader"/>
|
||||
/// <see cref="AssemblyResourceLoader"/>
|
||||
/// <author>Erez Mazor (.NET) </author>
|
||||
[CLSCompliant(false)]
|
||||
public class SpringResourceLoader : ResourceLoader
|
||||
{
|
||||
///<summary>
|
||||
/// Prefix used for the NVelocity Configuration
|
||||
///</summary>
|
||||
public const string NAME = "spring";
|
||||
|
||||
/// <summary>
|
||||
/// The IResourceLoader implementation type
|
||||
/// </summary>
|
||||
public const string SPRING_RESOURCE_LOADER_CLASS = "spring.resource.loader.class";
|
||||
|
||||
/// <summary>
|
||||
/// A flag indicating weather a template cache is used
|
||||
/// </summary>
|
||||
public const string SPRING_RESOURCE_LOADER_CACHE = "spring.resource.loader.cache";
|
||||
|
||||
///<summary>
|
||||
/// Fully qualified name of the IResourceLoader implementation class
|
||||
///</summary>
|
||||
public const string SPRING_RESOURCE_LOADER = "spring.resource.loader";
|
||||
|
||||
/// <summary>
|
||||
/// A comma delimited list of paths used by the spring IResourceLoader implementation
|
||||
/// </summary>
|
||||
public const string SPRING_RESOURCE_LOADER_PATH = "spring.resource.loader.path";
|
||||
|
||||
/// <summary>
|
||||
/// Shared logger instance.
|
||||
/// </summary>
|
||||
protected static readonly ILog log = LogManager.GetLogger(typeof(SpringResourceLoader));
|
||||
|
||||
private IResourceLoader resourceLoader;
|
||||
|
||||
private string[] resourceLoaderPaths;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the template loader with a resources class.
|
||||
/// </summary>
|
||||
/// <param name="configuration">The ExtendedProperties representing the Velocity configuration.</param>
|
||||
public override void Init(ExtendedProperties configuration)
|
||||
{
|
||||
resourceLoader = (IResourceLoader)runtimeServices.GetApplicationAttribute(SPRING_RESOURCE_LOADER);
|
||||
string resourceLoaderPath = (string)runtimeServices.GetApplicationAttribute(SPRING_RESOURCE_LOADER_PATH);
|
||||
if (resourceLoader == null)
|
||||
{
|
||||
throw new ArgumentException("'resourceLoader' application attribute must be present for SpringResourceLoader");
|
||||
}
|
||||
if (null == resourceLoaderPath)
|
||||
{
|
||||
throw new ArgumentException("'resourceLoaderPath' application attribute must be present for SpringResourceLoader");
|
||||
}
|
||||
resourceLoaderPaths = resourceLoaderPath.Split(',');
|
||||
for (int i = 0; i < resourceLoaderPaths.Length; i++)
|
||||
{
|
||||
string path = resourceLoaderPaths[i];
|
||||
if (!path.EndsWith("/"))
|
||||
{
|
||||
resourceLoaderPaths[i] = path + "/";
|
||||
}
|
||||
}
|
||||
if (log.IsInfoEnabled)
|
||||
{
|
||||
log.Info(string.Format("SpringResourceLoader for Velocity: using resource loader [{0}] and resource loader paths {1}", resourceLoader, resourceLoaderPaths));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the <code>System.IO.Stream</code> that the Runtime will parse to create a template.
|
||||
/// </summary>
|
||||
/// <param name="source">the source template name</param>
|
||||
/// <returns>a System.IO.Stream representation of the resource</returns>
|
||||
public override Stream GetResourceStream(string source)
|
||||
{
|
||||
if (log.IsDebugEnabled)
|
||||
{
|
||||
log.Debug(string.Format("Looking for Velocity resource with name [{0}]", source));
|
||||
}
|
||||
|
||||
foreach (string resourceLoaderPath in resourceLoaderPaths)
|
||||
{
|
||||
IResource resource = resourceLoader.GetResource(resourceLoaderPath + source);
|
||||
try
|
||||
{
|
||||
return resource.InputStream;
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
if (log.IsErrorEnabled)
|
||||
{
|
||||
log.Error(string.Format("Could not find Velocity resource: {0}", resource), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new ArgumentException(string.Format("Could not find resource [{0}] in Spring resource loader path", source));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Given a template, check to see if the source of InputStream has been modified.
|
||||
/// </summary>
|
||||
/// <param name="resource">The resource.</param>
|
||||
/// <returns>
|
||||
/// <c>true</c> if the source of the InputStream has been modified; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
public override bool IsSourceModified(Resource resource)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the last modified time of the InputStream source
|
||||
/// that was used to create the template. We need the template
|
||||
/// here because we have to extract the name of the template
|
||||
/// in order to locate the InputStream source.
|
||||
/// </summary>
|
||||
/// <param name="resource">The resource.</param>
|
||||
/// <returns></returns>
|
||||
public override long GetLastModified(Resource resource)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Castle.NVelocity" version="1.1.1" targetFramework="net40" />
|
||||
<package id="Common.Logging" version="3.0.0" targetFramework="net40" />
|
||||
<package id="Common.Logging.Core" version="3.0.0" targetFramework="net40" />
|
||||
</packages>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -316,6 +316,9 @@
|
||||
<Name>Spring.Core.Tests.2010</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
|
||||
@@ -1023,6 +1023,9 @@
|
||||
<Name>Spring.Template.Velocity.2010</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Data\AccountCreditDao.cs" />
|
||||
|
||||
@@ -235,6 +235,9 @@
|
||||
<Name>Spring.Data.2010</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</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.
|
||||
|
||||
@@ -169,6 +169,9 @@
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</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.
|
||||
|
||||
@@ -238,6 +238,9 @@
|
||||
<Name>Spring.Data.2010</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</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.
|
||||
|
||||
@@ -171,6 +171,9 @@
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</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.
|
||||
|
||||
@@ -128,6 +128,7 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\CommonAssemblyInfo.cs">
|
||||
|
||||
@@ -141,6 +141,9 @@
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -132,6 +132,9 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -130,6 +130,9 @@
|
||||
<None Include="packages.config" />
|
||||
<None Include="Spring.Messaging.Tests.build" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -128,6 +128,9 @@
|
||||
<Name>Spring.Scheduling.Quartz2.2010</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -106,7 +106,9 @@
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="QuartzCompilerOptionsTests.cs" />
|
||||
<Compile Include="Scheduling\Quartz\AdaptableJobFactoryTest.cs" />
|
||||
|
||||
@@ -226,6 +226,9 @@
|
||||
<EmbeddedResource Include="ServiceModel\Config\ChannelFactoryObjectDefinitionParserTests.CustomProperties.xml" />
|
||||
<EmbeddedResource Include="ServiceModel\Config\ChannelFactoryObjectDefinitionParserTests.BasicConfig.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
|
||||
16
test/Spring/Spring.Template.Velocity.Castle.Tests/App.config
Normal file
16
test/Spring/Spring.Template.Velocity.Castle.Tests/App.config
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<sectionGroup name="spring">
|
||||
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<spring>
|
||||
<parsers>
|
||||
<parser type="Spring.Template.Velocity.Config.TemplateNamespaceParser, Spring.Template.Velocity.Castle" />
|
||||
</parsers>
|
||||
</spring>
|
||||
|
||||
</configuration>
|
||||
@@ -0,0 +1,122 @@
|
||||
<?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>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{8D6ED392-8A1F-41C0-A765-22CF384EDEA1}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring</RootNamespace>
|
||||
<AssemblyName>Spring.Template.Velocity.Castle.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation />
|
||||
<TargetFrameworkProfile />
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2010\Spring.Template.Velocity.Castle.Tests\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NET_4_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2010\Spring.Template.Velocity.Castle.Tests\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NET_4_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Common.Logging">
|
||||
<HintPath>..\..\..\packages\Common.Logging.3.0.0\lib\net40\Common.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Common.Logging.Core">
|
||||
<HintPath>..\..\..\packages\Common.Logging.Core.3.0.0\lib\net40\Common.Logging.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NVelocity">
|
||||
<HintPath>..\..\..\packages\Castle.NVelocity.1.1.1\lib\net40\NVelocity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Spring.Template.Velocity.Tests\Template\Velocity\Config\TemplateNamespaceParserTests.cs">
|
||||
<Link>Template\Velocity\Config\TemplateNamespaceParserTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Template.Velocity.Tests\Template\Velocity\VelocityEngineFactoryObjectTests.cs">
|
||||
<Link>Template\Velocity\VelocityEngineFactoryObjectTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Template.Velocity.Tests\Template\Velocity\VelocityEngineTestBase.cs">
|
||||
<Link>Template\Velocity\VelocityEngineTestBase.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Template.Velocity.Tests\VelocityCompilerOptionsTests.cs">
|
||||
<Link>VelocityCompilerOptionsTests.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.2010.csproj">
|
||||
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
|
||||
<Name>Spring.Core.2010</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Template.Velocity.Castle\Spring.Template.Velocity.Castle.2010.csproj">
|
||||
<Project>{250601c0-a4ac-41fe-b484-51a9b0d5473d}</Project>
|
||||
<Name>Spring.Template.Velocity.Castle.2010</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Spring.Core.Tests\Spring.Core.Tests.2010.csproj">
|
||||
<Project>{44B16BAA-6DF8-447C-9D7F-3AD3D854D904}</Project>
|
||||
<Name>Spring.Core.Tests.2010</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\Spring.Template.Velocity.Tests\Template\Velocity\EmbeddedTemplate.vm">
|
||||
<Link>Template\Velocity\EmbeddedTemplate.vm</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="..\Spring.Template.Velocity.Tests\Template\Velocity\SimpleTemplate.vm">
|
||||
<Link>Template\Velocity\SimpleTemplate.vm</Link>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Template\Velocity\config.properties">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Template\Velocity\VelocityEngineFactoryObjectTests.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.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>
|
||||
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" ?>
|
||||
<project name="Spring.Template.Velocity.Tests" default="test" xmlns="http://nant.sf.net/schemas/nant.xsd">
|
||||
|
||||
<include buildfile="${spring.basedir}/common-project.include" />
|
||||
|
||||
<!--
|
||||
Required properties:
|
||||
* current.bin.dir - (path) root level to build to
|
||||
* build.debug - (true|false) debug build?
|
||||
* current.build.defines.csc - framework-specific build defines
|
||||
-->
|
||||
<target name="build">
|
||||
|
||||
<csc target="library" define="${current.build.defines.csc}"
|
||||
warnaserror="true"
|
||||
optimize="${build.optimize}"
|
||||
debug="${current.build.debug}"
|
||||
output="${current.bin.dir}/${project::get-name()}.dll"
|
||||
doc="${current.bin.dir}/${project::get-name()}.xml"
|
||||
nostdlib="true"
|
||||
noconfig="true"
|
||||
>
|
||||
<nowarn>
|
||||
<warning number="${nowarn.numbers.test}" />
|
||||
</nowarn>
|
||||
<sources failonempty="true">
|
||||
<include name="**/*.cs" />
|
||||
<include name="../CommonAssemblyInfo.cs" />
|
||||
</sources>
|
||||
<references>
|
||||
<include name="mscorlib.dll"/>
|
||||
<include name="Microsoft.CSharp.dll"/>
|
||||
<include name="System.dll"/>
|
||||
<include name="System.Configuration.dll"/>
|
||||
<include name="System.Core.dll"/>
|
||||
<include name="${current.bin.dir}/*.dll" />
|
||||
<exclude name="${current.bin.dir}/${project::get-name()}.dll" />
|
||||
</references>
|
||||
<resources prefix="Spring" dynamicprefix="true" failonempty="true">
|
||||
<include name="**/*.xml" />
|
||||
<include name="**/*.xsd" />
|
||||
<include name="**/*.test" />
|
||||
<include name="**/*.vm" />
|
||||
<include name="**/*.properties" />
|
||||
<include name="**/*.config" />
|
||||
</resources>
|
||||
</csc>
|
||||
<copy todir="${current.bin.dir}" failonerror="true">
|
||||
<fileset basedir="${project::get-base-directory()}">
|
||||
<include name="**/*.xml" />
|
||||
<include name="**/*.xsd" />
|
||||
<include name="**/*.test" />
|
||||
<include name="**/*.vm" />
|
||||
<include name="**/*.properties" />
|
||||
<include name="**/*.config" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="test" depends="build">
|
||||
<!-- property name="test.assemblyname" value="${project::get-name()}" / -->
|
||||
<call target="common.run-tests" />
|
||||
</target>
|
||||
<!--
|
||||
<target name="test" depends="build">
|
||||
<nunit2>
|
||||
<formatter type="Plain" />
|
||||
<formatter type="Xml" usefile="true" extension=".xml"
|
||||
outputdir="${current.bin.dir}/results" />
|
||||
<test assemblyname="${current.bin.dir}/${project::get-name()}.dll"
|
||||
appconfig="${current.bin.dir}/${project::get-name()}.dll.config" />
|
||||
</nunit2>
|
||||
</target>
|
||||
|
||||
<target name="test-mono-1.0" >
|
||||
<nunit2>
|
||||
<formatter type="Plain" />
|
||||
<formatter type="Xml" usefile="true" extension=".xml"
|
||||
outputdir="${current.bin.dir}/results" />
|
||||
<test assemblyname="${bin.dir}/net/1.1/${current.build.config}/${project::get-name()}.dll"
|
||||
appconfig="${bin.dir}/net/1.1/${current.build.config}/${project::get-name()}.dll.config" />
|
||||
</nunit2>
|
||||
</target>
|
||||
-->
|
||||
</project>
|
||||
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{8D6ED392-8A1F-41C0-A765-22CF384EDEA1}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring</RootNamespace>
|
||||
<AssemblyName>Spring.Template.Velocity.Castle.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkSubset>
|
||||
</TargetFrameworkSubset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2008\Spring.Template.Velocity.Castle.Tests\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NET_2_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2008\Spring.Template.Velocity.Castle.Tests\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NET_2_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework, Version=2.4.1.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\Net\2.0\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NVelocity, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\Net\2.0\NVelocity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Template\Velocity\Config\TemplateNamespaceParserTests.cs" />
|
||||
<Compile Include="Template\Velocity\VelocityEngineFactoryObjectTests.cs" />
|
||||
<Compile Include="Template\Velocity\VelocityEngineTestBase.cs" />
|
||||
<Compile Include="VelocityCompilerOptionsTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.2008.csproj">
|
||||
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
|
||||
<Name>Spring.Core.2008</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Template.Velocity\Spring.Template.Velocity.2008.csproj">
|
||||
<Project>{BF3AB954-8375-407C-9E98-4C51D8072784}</Project>
|
||||
<Name>Spring.Template.Velocity.2008</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Spring.Core.Tests\Spring.Core.Tests.2008.csproj">
|
||||
<Project>{44B16BAA-6DF8-447C-9D7F-3AD3D854D904}</Project>
|
||||
<Name>Spring.Core.Tests.2008</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Template\Velocity\VelocityEngineFactoryObjectTests.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Template\Velocity\SimpleTemplate.vm">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Template\Velocity\config.properties">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<EmbeddedResource Include="Template\Velocity\EmbeddedTemplate.vm">
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\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>
|
||||
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns="http://www.springframework.net" xmlns:nv="http://www.springframework.net/nvelocity">
|
||||
|
||||
<nv:engine id="cnFileVelocityEngine" >
|
||||
<nv:resource-loader default-cache-size="200" modification-check-interval="30" template-caching="true">
|
||||
<nv:file path="Template/Velocity/" />
|
||||
<nv:file path="Template/" />
|
||||
</nv:resource-loader>
|
||||
</nv:engine>
|
||||
|
||||
<nv:engine id="cnAssemblyVelocityEngine" >
|
||||
<nv:resource-loader default-cache-size="200" modification-check-interval="30" template-caching="true">
|
||||
<nv:assembly name="Spring.Template.Velocity.Castle.Tests" />
|
||||
</nv:resource-loader>
|
||||
</nv:engine>
|
||||
|
||||
<nv:engine id="cnSpringVelocityEngine" prefer-file-system-access="false">
|
||||
<nv:resource-loader default-cache-size="200" modification-check-interval="30" template-caching="true">
|
||||
<nv:spring uri="file://Template/Velocity/"/>
|
||||
<nv:spring uri="assembly://Spring.Template.Velocity.Castle.Tests/Spring.Template.Velocity/"/>
|
||||
</nv:resource-loader>
|
||||
</nv:engine>
|
||||
|
||||
<nv:engine id="cnVelocityEngineConfig" config-file="file://Template/Velocity/config.properties" override-logging="false" />
|
||||
|
||||
<nv:engine id="cnVelocityEngineLocalConfig" >
|
||||
<nv:nvelocity-properties>
|
||||
<entry key="input.encoding" value="UTF-8"/>
|
||||
<entry key="myproperty.mysubproperty" value="TEST_VALUE"/>
|
||||
</nv:nvelocity-properties>
|
||||
</nv:engine>
|
||||
|
||||
<nv:engine id="cnVelocityEngingCustomResourceLoader">
|
||||
<nv:resource-loader default-cache-size="200" modification-check-interval="30" template-caching="true">
|
||||
<nv:custom name="myResourceLoader"
|
||||
description="A custom resource loader"
|
||||
type="Spring.Template.Velocity.Config.TestCustomResourceLoader, Spring.Template.Velocity.Castle.Tests"
|
||||
path="Template/Velocity/"/>
|
||||
</nv:resource-loader>
|
||||
</nv:engine>
|
||||
|
||||
<!-- Does file system access with hot tracking with NVelocity assembly resource loader -->
|
||||
<object id="assemblyBasedVelocityEngine" type="Spring.Template.Velocity.VelocityEngineFactoryObject, Spring.Template.Velocity.Castle">
|
||||
<property name="VelocityProperties">
|
||||
<dictionary key-type="string" value-type="object">
|
||||
<entry key="resource.loader" value="assembly"/>
|
||||
<entry key="assembly.resource.loader.class" value="NVelocity.Runtime.Resource.Loader.AssemblyResourceLoader"/>
|
||||
<entry key="assembly.resource.loader.assembly" value="Spring.Template.Velocity.Castle.Tests"/>
|
||||
</dictionary>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<!-- Simple no arg file based configuration use's NVeclocity default file resource loader -->
|
||||
<object id="fileBasedVelocityEngine" type="Spring.Template.Velocity.VelocityEngineFactoryObject, Spring.Template.Velocity.Castle" />
|
||||
|
||||
<!-- File based NVelocity resource loader, directory based configuration-->
|
||||
<object id="pathBasedVelocityEngine" type="Spring.Template.Velocity.VelocityEngineFactoryObject, Spring.Template.Velocity.Castle" >
|
||||
<property name="ResourceLoaderPath " value="Template/Velocity/" />
|
||||
<!--
|
||||
<property name="ResourceLoaderPaths" >
|
||||
<list>
|
||||
<value>Path1</value>
|
||||
<value>Path2</value>
|
||||
</list>
|
||||
</property>
|
||||
-->
|
||||
</object>
|
||||
|
||||
<!-- Spring based defualt file fallback to spring definition -->
|
||||
<object id="springFallbackVelocityEngine" type="Spring.Template.Velocity.VelocityEngineFactoryObject, Spring.Template.Velocity.Castle" >
|
||||
<property name="ResourceLoaderPath " value="assembly://Spring.Template.Velocity.Castle.Tests/Spring.Template.Velocity/" />
|
||||
</object>
|
||||
|
||||
|
||||
<!-- Configuration comes from a properties file -->
|
||||
<object id="propertiesFileBasedVelocityEngine" type="Spring.Template.Velocity.VelocityEngineFactoryObject, Spring.Template.Velocity.Castle" >
|
||||
<property name="ConfigLocation " value="file://Template/Velocity/config.properties" />
|
||||
</object>
|
||||
|
||||
<!-- Use (ConfigurableResourceLoader) spring resource abstraction for templates that are not file or assembly based -->
|
||||
<object id="springResourceLoaderBasedVelocityEngine" type="Spring.Template.Velocity.VelocityEngineFactoryObject, Spring.Template.Velocity.Castle" >
|
||||
<!--<property name="ResourceLoaderPath " value="http://somesite/template.vm" />-->
|
||||
<property name="ResourceLoaderPath " value="Template/Velocity/" />
|
||||
<property name="PreferFileSystemAccess " value="false" />
|
||||
</object>
|
||||
</objects>
|
||||
@@ -0,0 +1,4 @@
|
||||
resource.loader=assembly
|
||||
assembly.resource.loader.class=NVelocity.Runtime.Resource.Loader.AssemblyResourceLoader
|
||||
assembly.resource.loader.assembly=Spring.Template.Velocity.Castle.Tests
|
||||
assembly.resource.loader.description=TestDescription
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Castle.NVelocity" version="1.1.1" targetFramework="net40" />
|
||||
<package id="Common.Logging" version="3.0.0" targetFramework="net40" />
|
||||
<package id="Common.Logging.Core" version="3.0.0" targetFramework="net40" />
|
||||
<package id="NUnit" version="2.6.3" targetFramework="net40" />
|
||||
</packages>
|
||||
@@ -98,6 +98,9 @@
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Spring.Template.Velocity.Config {
|
||||
Assert.AreEqual(VelocityConstants.Assembly, getSingleProperty(velocityEngine, RuntimeConstants.RESOURCE_LOADER), "incorrect resource loader");
|
||||
Assert.AreEqual(TemplateDefinitionConstants.AssemblyResourceLoaderClass, getSingleProperty(velocityEngine,
|
||||
TemplateNamespaceParser.getResourceLoaderProperty(VelocityConstants.Assembly, VelocityConstants.Class)), "incorrect resource loader type");
|
||||
Assert.AreEqual("Spring.Template.Velocity.Tests", getSingleProperty(velocityEngine,
|
||||
Assert.AreEqual("Spring.Template.Velocity.Castle.Tests", getSingleProperty(velocityEngine,
|
||||
TemplateNamespaceParser.getResourceLoaderProperty(VelocityConstants.Assembly,VelocityConstants.Assembly)), "incorrect resource loader path");
|
||||
Assert.AreEqual(DEFAULT_CACHE_SIZE, velocityEngine.GetProperty(RuntimeConstants.RESOURCE_MANAGER_DEFAULTCACHE_SIZE), "incorrect default cache size");
|
||||
Assert.AreEqual(DEFAULT_CACHE_FLAG, velocityEngine.GetProperty(VelocityConstants.Assembly + VelocityConstants.Separator + PropertyResourceLoaderCachce),
|
||||
@@ -155,7 +155,7 @@ namespace Spring.Template.Velocity.Config {
|
||||
|
||||
Assert.AreEqual(PropertyMyResourceLoader, getSingleProperty(velocityEngine, RuntimeConstants.RESOURCE_LOADER), "incorrect resource loader");
|
||||
|
||||
Assert.AreEqual("Spring.Template.Velocity.Config.TestCustomResourceLoader; Spring.Template.Velocity.Tests",
|
||||
Assert.AreEqual("Spring.Template.Velocity.Config.TestCustomResourceLoader; Spring.Template.Velocity.Castle.Tests",
|
||||
getSingleProperty(velocityEngine, classProp), "incorrect resource loader type");
|
||||
Assert.AreEqual(PropertyMyResourceLoader, getSingleProperty(velocityEngine, RuntimeConstants.RESOURCE_LOADER), "incorrect resource loader");
|
||||
Assert.AreEqual("A custom resource loader",
|
||||
|
||||
@@ -96,6 +96,9 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -301,6 +301,9 @@
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</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.
|
||||
|
||||
@@ -122,6 +122,9 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -153,6 +153,9 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -135,6 +135,9 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -254,6 +254,9 @@
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
|
||||
Reference in New Issue
Block a user