init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
74
Kreta.KretaServer/ServerUtil/KretaConfiguration.cs
Normal file
74
Kreta.KretaServer/ServerUtil/KretaConfiguration.cs
Normal file
|
@ -0,0 +1,74 @@
|
|||
using System;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using Kreta.Framework;
|
||||
|
||||
namespace Kreta.KretaServer
|
||||
{
|
||||
public class KretaConfiguration : Configuration
|
||||
{
|
||||
public KretaConfiguration(XmlNode confignode) : base(confignode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void ReadConfig(XmlNode confignode)
|
||||
{
|
||||
string xpath = "";
|
||||
|
||||
try
|
||||
{
|
||||
base.ReadConfig(confignode);
|
||||
|
||||
if (!DBConnection.EndsWith(";", StringComparison.Ordinal))
|
||||
{
|
||||
DBConnection += ";";
|
||||
}
|
||||
//if (DBConnection.IndexOf("Max Pool Size", StringComparison.OrdinalIgnoreCase) < 0)
|
||||
// DBConnection += "Max Pool Size=" + (SessionLimit < 100 ? 100 : SessionLimit) + ";";
|
||||
|
||||
XmlNode current = null;
|
||||
xpath = "/config/server/intezmenyconnectionstringfile";
|
||||
if ((current = confignode.SelectSingleNode(xpath)) != null)
|
||||
{
|
||||
intezmenyConnectionStringFile = current.InnerText;
|
||||
if (intezmenyConnectionStringFile.Contains("~") && (HttpContext.Current != null))
|
||||
{
|
||||
intezmenyConnectionStringFile = HttpContext.Current.Server.MapPath(intezmenyConnectionStringFile);
|
||||
}
|
||||
}
|
||||
|
||||
xpath = "/config/server/tesztintezmenyazonosito";
|
||||
if ((current = confignode.SelectSingleNode(xpath)) != null)
|
||||
{
|
||||
tesztIntezmenyAzonosito = current.InnerText;
|
||||
}
|
||||
xpath = "/config/server/mkbbankszamlaigenylesconnectionstringfile";
|
||||
if ((current = confignode.SelectSingleNode(xpath)) != null)
|
||||
{
|
||||
bankszamlaIgenylesConnectionStringFile = current.InnerText;
|
||||
if (bankszamlaIgenylesConnectionStringFile.Contains("~") && (HttpContext.Current != null))
|
||||
{
|
||||
bankszamlaIgenylesConnectionStringFile = HttpContext.Current.Server.MapPath(bankszamlaIgenylesConnectionStringFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (InvalidConfigurationException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw new InvalidConfigurationException("Invalid configuration entry: " + xpath + ".", exception);
|
||||
}
|
||||
}
|
||||
|
||||
private string intezmenyConnectionStringFile;
|
||||
private string tesztIntezmenyAzonosito;
|
||||
private string bankszamlaIgenylesConnectionStringFile;
|
||||
|
||||
public string IntezmenyConnectionStringFile { get { return intezmenyConnectionStringFile; } }
|
||||
public string BankszamlaIgenylesConnectionStringFile { get { return bankszamlaIgenylesConnectionStringFile; } }
|
||||
|
||||
public string TesztIntezmenyAzonosito { get { return tesztIntezmenyAzonosito; } }
|
||||
}
|
||||
}
|
37
Kreta.KretaServer/ServerUtil/KretaConnectionManager.cs
Normal file
37
Kreta.KretaServer/ServerUtil/KretaConnectionManager.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System.Collections.Generic;
|
||||
using Kreta.Framework;
|
||||
using Kreta.Framework.Session;
|
||||
using Kreta.KretaServer.Caching;
|
||||
|
||||
namespace Kreta.KretaServer.ServerUtil
|
||||
{
|
||||
public class KretaConnectionManager : ConnectionManager
|
||||
{
|
||||
private readonly ConnectionStringCache connectionStringCache = SDAServer.Instance.CacheManager.AquireCache<ConnectionStringCache>();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
connectionStringCache.FillCache();
|
||||
}
|
||||
|
||||
public override IEnumerable<string> GetOsszesIntezmeny()
|
||||
{
|
||||
return connectionStringCache.GetOsszesIntezmeny();
|
||||
}
|
||||
|
||||
public override string GetIntezmenyConnectionString(string intezmenyAzonosito)
|
||||
{
|
||||
return connectionStringCache.GetIntezmenyConnectionString(intezmenyAzonosito);
|
||||
}
|
||||
|
||||
public override string GetSystemConnectionString(string intezmenyAzonosito)
|
||||
{
|
||||
return connectionStringCache.GetSystemConnectionString(intezmenyAzonosito);
|
||||
}
|
||||
|
||||
public override IEnumerable<string> GetSystemConnectionStrings()
|
||||
{
|
||||
return connectionStringCache.GetSystemConnectionStrings();
|
||||
}
|
||||
}
|
||||
}
|
152
Kreta.KretaServer/ServerUtil/KretaServer.cs
Normal file
152
Kreta.KretaServer/ServerUtil/KretaServer.cs
Normal file
|
@ -0,0 +1,152 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using Kreta.Framework;
|
||||
using Kreta.Framework.Session;
|
||||
using Kreta.KretaServer.ServerUtil;
|
||||
|
||||
namespace Kreta.KretaServer
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// A Kréta kiszolgáló.
|
||||
/// </summary>
|
||||
public class KretaServer : SDAApplicationServer
|
||||
{
|
||||
public KretaServer(string configPath) : base(configPath)
|
||||
{
|
||||
}
|
||||
|
||||
public KretaServer(XmlNode configNode) : base(configNode)
|
||||
{
|
||||
}
|
||||
|
||||
public static new KretaServer Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return (KretaServer)SDAServer.Instance;
|
||||
}
|
||||
}
|
||||
|
||||
public new KretaConfiguration Configuration
|
||||
{
|
||||
get
|
||||
{
|
||||
return (KretaConfiguration)base.Configuration;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Intézményi azonosító kiszedése az URL-ből.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string GetOrganizationIdentifier()
|
||||
{
|
||||
var identifier = Configuration.TesztIntezmenyAzonosito;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(identifier))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (HttpContext.Current != null)
|
||||
{
|
||||
var request = HttpContext.Current.Request.Url.AbsoluteUri;
|
||||
var requestArray = request.Replace("http://", null).Replace("https://", null).Split('.');
|
||||
if (requestArray.Length > 1)
|
||||
{
|
||||
identifier = requestArray[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return identifier;
|
||||
}
|
||||
|
||||
public override string GetIntezmenyConnectionString(string intezmenyAzonosito)
|
||||
{
|
||||
return ConnectionManager.GetIntezmenyConnectionString(intezmenyAzonosito);
|
||||
}
|
||||
|
||||
public override string GetSystemConnectionString(string intezmenyAzonosito)
|
||||
{
|
||||
return ConnectionManager.GetSystemConnectionString(intezmenyAzonosito);
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetOsszesIntezmeny()
|
||||
{
|
||||
return ConnectionManager.GetOsszesIntezmeny();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Karakterlánccá alakítja az objektumot.
|
||||
/// </summary>
|
||||
/// <returns>Az objektum leírása.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
if (Configuration == null)
|
||||
{
|
||||
return "KRETA server";
|
||||
}
|
||||
|
||||
if (IsRunning)
|
||||
{
|
||||
return $"{Configuration.ServerName} server (running)";
|
||||
}
|
||||
|
||||
return $"{Configuration.ServerName} server (stopped)";
|
||||
}
|
||||
|
||||
protected override Configuration DoReadConfiguration(XmlNode configNode)
|
||||
{
|
||||
return new KretaConfiguration(configNode);
|
||||
}
|
||||
|
||||
protected virtual void CreateConnectionManager()
|
||||
{
|
||||
ConnectionManager = new KretaConnectionManager();
|
||||
|
||||
ConnectionManager.Initialize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elindítja a kiszolgálót.
|
||||
/// </summary>
|
||||
protected override void DoStart()
|
||||
{
|
||||
base.DoStart();
|
||||
|
||||
CreateConnectionManager();
|
||||
|
||||
if (Configuration.SystemType == SystemType.Ismeretlen)
|
||||
{
|
||||
throw new Exception("Nincs beállítva a Kréta rendszer típusa a config-ban!");
|
||||
}
|
||||
|
||||
//TODO: itt lehet finomhangolni a session naplozast amennyiben szukseges. adtam egy alapertelmezett implementaciot, ami csak signon/signoff esetben
|
||||
//naploz, hogy csokkentsem a dbhez fordulasok szamat. ha ettol pontosabb kep kell akkor be lehet kapcsolni az activate/deactivate lehetoseget is
|
||||
//Ha valakinek nem tetszik az altalam adott implementacio a naplora itt kotheti be a sajatjat.
|
||||
//glhf ^.^;
|
||||
this.SessionManager.SessionCreated += new SessionCreatedEventHandler(new Framework.Session.Instrumentation.SessionLogger().SessionCreated);
|
||||
this.SessionManager.SessionDeleted += new SessionDeletedEventHandler(new Framework.Session.Instrumentation.SessionLogger().SessionDeleted);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Leállítja a kiszolgálót.
|
||||
/// </summary>
|
||||
protected override void DoStop()
|
||||
{
|
||||
base.DoStop();
|
||||
}
|
||||
|
||||
protected override SessionManager CreateSessionManager(Configuration configuration, Framework.Caching.CacheManager cacheManager)
|
||||
{
|
||||
return new SessionManager(configuration, cacheManager);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue