resolved SPRNET-1109, SPRNET-1095
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<sectionGroup name="common">
|
||||
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
|
||||
</sectionGroup>
|
||||
<sectionGroup name="spring">
|
||||
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core" />
|
||||
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
|
||||
@@ -9,6 +12,14 @@
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<common>
|
||||
<logging>
|
||||
<factoryAdapter type="Common.Logging.Simple.TraceLoggerFactoryAdapter, Common.Logging">
|
||||
<arg key="level" value="ALL" />
|
||||
</factoryAdapter>
|
||||
</logging>
|
||||
</common>
|
||||
|
||||
<spring>
|
||||
|
||||
<parsers>
|
||||
@@ -23,7 +34,7 @@
|
||||
<!-- ================================== -->
|
||||
<!-- In process (local) implementations -->
|
||||
<!-- ================================== -->
|
||||
<resource uri="assembly://Spring.Calculator.ClientApp/Spring.Calculator.ClientApp.Config.InProcess/inProcess.xml" />
|
||||
<!-- resource uri="assembly://Spring.Calculator.ClientApp/Spring.Calculator.ClientApp.Config.InProcess/inProcess.xml" /-->
|
||||
|
||||
<!-- ======================== -->
|
||||
<!-- Remoting implementations -->
|
||||
@@ -53,7 +64,7 @@
|
||||
<!-- EnterpriseService implementations -->
|
||||
<!-- ================================= -->
|
||||
<!-- Make sure you register components with 'RegisterComponentServices' console application. -->
|
||||
<!--<resource uri="assembly://Spring.Calculator.ClientApp/Spring.Calculator.ClientApp.Config.EnterpriseServices/enterpriseServices.xml" />-->
|
||||
<resource uri="assembly://Spring.Calculator.ClientApp/Spring.Calculator.ClientApp.Config.EnterpriseServices/enterpriseServices.xml" />
|
||||
|
||||
</context>
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ using System.Reflection;
|
||||
#endif
|
||||
[assembly: AssemblyCompany("http://www.springframework.net")]
|
||||
[assembly: AssemblyProduct("Spring.NET Framework")]
|
||||
[assembly: AssemblyCopyright("Copyright 2002-2006 Spring.NET Framework Team.")]
|
||||
[assembly: AssemblyCopyright("Copyright 2002-2008 Spring.NET Framework Team.")]
|
||||
[assembly: AssemblyTrademark("Apache License, Version 2.0")]
|
||||
|
||||
#if STRONG
|
||||
|
||||
Binary file not shown.
@@ -2,26 +2,30 @@
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<sectionGroup name="spring">
|
||||
<sectionGroup name="common">
|
||||
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
|
||||
</sectionGroup>
|
||||
<sectionGroup name="spring">
|
||||
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core" />
|
||||
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<spring>
|
||||
<common>
|
||||
<logging>
|
||||
<factoryAdapter type="Common.Logging.Simple.TraceLoggerFactoryAdapter, Common.Logging">
|
||||
<arg key="level" value="ALL" />
|
||||
</factoryAdapter>
|
||||
</logging>
|
||||
</common>
|
||||
|
||||
<spring>
|
||||
|
||||
<context>
|
||||
<resource uri="config://spring/objects" />
|
||||
<resource uri="Config/services.xml" />
|
||||
<resource uri="assembly://Spring.Calculator.RegisterComponentServices/Spring.Calculator.RegisterComponentServices.Config/enterpriseServices.xml" />
|
||||
</context>
|
||||
|
||||
<objects xmlns="http://www.springframework.net">
|
||||
<description>Definitions of objects to be registered.</description>
|
||||
|
||||
<object id="calculatorService" type="Spring.Calculator.Services.AdvancedCalculator, Spring.Calculator.Services" />
|
||||
|
||||
</objects>
|
||||
|
||||
</spring>
|
||||
|
||||
</configuration>
|
||||
@@ -21,15 +21,41 @@
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<object id="simpleCalculatorComponent" type="Spring.EnterpriseServices.ServicedComponentExporter, Spring.Services">
|
||||
<property name="TargetName" value="simpleCalculatorService" />
|
||||
</object>
|
||||
|
||||
<object type="Spring.EnterpriseServices.EnterpriseServicesExporter, Spring.Services">
|
||||
<property name="ApplicationName">
|
||||
<value>Spring Calculator Application</value>
|
||||
</property>
|
||||
<property name="Description">
|
||||
<value>Spring Calculator application.</value>
|
||||
<!-- assembly name to generated - will generate 'Spring.Calculator.EnterpriseServices.dll' -->
|
||||
<property name="Assembly" value="Spring.Calculator.EnterpriseServices" />
|
||||
<!--
|
||||
use Spring's ContextRegistry for managing services. if true,
|
||||
requires a file 'Spring.Calculator.EnterpriseServices.dll.spring-context.xml'
|
||||
containing a <context /> section placed next to the generated assembly
|
||||
-->
|
||||
<property name="UseSpring" value="true" />
|
||||
<property name="ApplicationName" value="Spring Calculator Application" />
|
||||
<property name="ActivationMode" value="Library" />
|
||||
<property name="Description" value="Spring Calculator application" />
|
||||
<property name="Components">
|
||||
<list>
|
||||
<ref object="calculatorComponent" />
|
||||
<ref object="simpleCalculatorComponent" />
|
||||
</list>
|
||||
</property>
|
||||
<property name="AccessControl">
|
||||
<object type="System.EnterpriseServices.ApplicationAccessControlAttribute, System.EnterpriseServices">
|
||||
<property name="Value">
|
||||
<value>false</value>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
<!--
|
||||
<property name="AccessControl">
|
||||
<object type="System.EnterpriseServices.ApplicationAccessControlAttribute, System.EnterpriseServices">
|
||||
<property name="Value">
|
||||
<value>true</value>
|
||||
</property>
|
||||
<property name="AccessChecksLevel">
|
||||
<value>ApplicationComponent</value>
|
||||
</property>
|
||||
@@ -42,14 +68,7 @@
|
||||
<value>Manager : Administrator role</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="Components">
|
||||
<list>
|
||||
<ref object="calculatorComponent" />
|
||||
</list>
|
||||
</property>
|
||||
<property name="Assembly">
|
||||
<value>Spring.Calculator.EnterpriseServices</value>
|
||||
</property>
|
||||
-->
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns="http://www.springframework.net">
|
||||
<description>Definitions of objects to be registered.</description>
|
||||
|
||||
<object id="calculatorService" type="Spring.Calculator.Services.AdvancedCalculator, Spring.Calculator.Services" />
|
||||
<object id="simpleCalculatorService" type="Spring.Calculator.Services.Calculator, Spring.Calculator.Services" />
|
||||
|
||||
</objects>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<context>
|
||||
<resource uri="Config/services.xml" />
|
||||
</context>
|
||||
@@ -17,9 +17,9 @@
|
||||
DelaySign = "false"
|
||||
OutputType = "Exe"
|
||||
PreBuildEvent = ""
|
||||
PostBuildEvent = ""
|
||||
PostBuildEvent = "xcopy $(ProjectDir)Spring.Calculator.EnterpriseServices.dll.spring-context.xml $(TargetDir) /Y /F
xcopy $(ProjectDir)Config\*.* $(TargetDir)Config /S /Y /F /I"
|
||||
RootNamespace = "Spring.Calculator.RegisterComponentServices"
|
||||
RunPostBuildEvent = "OnBuildSuccess"
|
||||
RunPostBuildEvent = "Always"
|
||||
StartupObject = ""
|
||||
>
|
||||
<Config
|
||||
@@ -102,10 +102,18 @@
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Spring.Calculator.EnterpriseServices.dll.spring-context.xml"
|
||||
BuildAction = "Content"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Config\enterpriseServices.xml"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Config\services.xml"
|
||||
BuildAction = "Content"
|
||||
/>
|
||||
</Include>
|
||||
</Files>
|
||||
</CSHARP>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2006 the original author or authors.
|
||||
* Copyright <20> 2002-2008 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.
|
||||
@@ -20,59 +20,66 @@
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Common.Logging;
|
||||
using Spring.Calculator.Interfaces;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Calculator.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// An advanced calculator service.
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// An advanced calculator service.
|
||||
/// </summary>
|
||||
/// <author>Bruno Baia</author>
|
||||
/// <version>$Id: AdvancedCalculator.cs,v 1.2 2006/12/04 01:38:42 bbaia Exp $</version>
|
||||
public class AdvancedCalculator : Calculator, IAdvancedCalculator
|
||||
{
|
||||
#region Fields
|
||||
#region Fields
|
||||
|
||||
private int memoryStore = 0;
|
||||
private int memoryStore = 0;
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Constructor(s) / Destructor
|
||||
#region Constructor(s) / Destructor
|
||||
|
||||
public AdvancedCalculator()
|
||||
{}
|
||||
public AdvancedCalculator()
|
||||
: this(0)
|
||||
{ }
|
||||
|
||||
public AdvancedCalculator(int initialMemory)
|
||||
{
|
||||
memoryStore = initialMemory;
|
||||
}
|
||||
public AdvancedCalculator(int initialMemory)
|
||||
{
|
||||
memoryStore = initialMemory;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region IAdvancedCalculator Members
|
||||
#region IAdvancedCalculator Members
|
||||
|
||||
public int GetMemory()
|
||||
{
|
||||
return memoryStore;
|
||||
}
|
||||
public int GetMemory()
|
||||
{
|
||||
Log.Debug(string.Format("GetMemory: IsInTransaction={0}, at {1}", System.EnterpriseServices.ContextUtil.IsInTransaction, new System.Diagnostics.StackTrace()));
|
||||
return memoryStore;
|
||||
}
|
||||
|
||||
public void SetMemory(int memoryValue)
|
||||
{
|
||||
memoryStore = memoryValue;
|
||||
}
|
||||
public void SetMemory(int memoryValue)
|
||||
{
|
||||
Log.Debug("SetMemory");
|
||||
memoryStore = memoryValue;
|
||||
}
|
||||
|
||||
public void MemoryClear()
|
||||
{
|
||||
memoryStore = 0;
|
||||
}
|
||||
public void MemoryClear()
|
||||
{
|
||||
Log.Debug("MemoryClear");
|
||||
memoryStore = 0;
|
||||
}
|
||||
|
||||
public void MemoryAdd(int num)
|
||||
{
|
||||
memoryStore += num;
|
||||
}
|
||||
public void MemoryAdd(int num)
|
||||
{
|
||||
Log.Debug("MemoryAdd");
|
||||
memoryStore += num;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2006 the original author or authors.
|
||||
* Copyright <20> 2002-2008 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.
|
||||
@@ -20,6 +20,10 @@
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using Common.Logging;
|
||||
using Spring.Calculator.Domain;
|
||||
using Spring.Calculator.Interfaces;
|
||||
|
||||
@@ -31,12 +35,37 @@ namespace Spring.Calculator.Services
|
||||
/// A calculator service.
|
||||
/// </summary>
|
||||
/// <author>Bruno Baia</author>
|
||||
/// <version>$Id: Calculator.cs,v 1.1 2006/10/29 18:39:13 bbaia Exp $</version>
|
||||
public class Calculator : ICalculator
|
||||
{
|
||||
// SimpleCalculator prints out this value to proof, that they are running within the same AppDomain.
|
||||
public static volatile int instanceCount;
|
||||
|
||||
static Calculator()
|
||||
{
|
||||
instanceCount = 0;
|
||||
ILog log = LogManager.GetLogger(MethodInfo.GetCurrentMethod().DeclaringType);
|
||||
log.Debug(
|
||||
string.Format("Initialized Type in AppDomain {0}, ConfigFile={1}, BaseDirectory={2}, CurrentDirectory={3}, ExecutingAssembly={4}, EntryAssembly={5}"
|
||||
, AppDomain.CurrentDomain.GetHashCode()
|
||||
, AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
|
||||
, AppDomain.CurrentDomain.BaseDirectory
|
||||
, Environment.CurrentDirectory
|
||||
, Assembly.GetExecutingAssembly().Location
|
||||
, Assembly.GetEntryAssembly().Location
|
||||
));
|
||||
}
|
||||
|
||||
#region ICalculator Members
|
||||
|
||||
public int Add(int n1, int n2)
|
||||
protected readonly ILog Log = LogManager.GetLogger(MethodInfo.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public Calculator()
|
||||
{
|
||||
Log.Debug(string.Format("Initialized Instance in AppDomain {0}, #{0} at {1}", AppDomain.CurrentDomain.GetHashCode(), instanceCount, new System.Diagnostics.StackTrace()));
|
||||
instanceCount++;
|
||||
}
|
||||
|
||||
public int Add(int n1, int n2)
|
||||
{
|
||||
return n1 + n2;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,16 @@
|
||||
Project = "{284C0873-BBB4-4399-B6F7-CB7EDBD001C7}"
|
||||
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
|
||||
/>
|
||||
<Reference
|
||||
Name = "Common.Logging"
|
||||
AssemblyName = "Common.Logging"
|
||||
HintPath = "..\..\..\..\..\lib\Net\1.1\Common.Logging.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.EnterpriseServices"
|
||||
AssemblyName = "System.EnterpriseServices"
|
||||
HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.EnterpriseServices.dll"
|
||||
/>
|
||||
</References>
|
||||
</Build>
|
||||
<Files>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<warning number="${nowarn.numbers}" />
|
||||
</nowarn>
|
||||
<references basedir="${current.bin.dir}">
|
||||
<include name="Common.Logging.dll" />
|
||||
<include name="Spring.Calculator.Contract.dll" />
|
||||
</references>
|
||||
</csc>
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user