DefaultHibernateSessionManager.cs hinzugefügt
This commit is contained in:
14
Android/BewoMitarbeiterApp/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
14
Android/BewoMitarbeiterApp/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
|
||||
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||
<option name="processCode" value="true" />
|
||||
<option name="processLiterals" value="true" />
|
||||
<option name="processComments" value="true" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
7
Android/BewoMitarbeiterApp/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
7
Android/BewoMitarbeiterApp/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
@@ -64,14 +64,6 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
@@ -80,6 +72,14 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
|
||||
|
||||
@@ -2,13 +2,9 @@ package soapConnection;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Created by JettenM on 05.07.2016.
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="beyondsoft.bewomitarbeiterapp.LoginActivity">
|
||||
|
||||
<!-- Login progress -->
|
||||
<ProgressBar
|
||||
android:id="@+id/login_progress"
|
||||
style="?android:attr/progressBarStyleLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/login_form"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/email_login_form"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/token"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/prompt_token"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/tenant"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/prompt_tenant"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/prompt_username"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/prompt_password"
|
||||
android:imeActionId="@+id/login"
|
||||
android:imeActionLabel="@string/action_sign_in_short"
|
||||
android:imeOptions="actionUnspecified"
|
||||
android:inputType="textPassword"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/remember_me_checkbox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/prompt_remember_me"
|
||||
android:onClick="rememberMeOnClick"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/sign_in_button"
|
||||
style="?android:textAppearanceSmall"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/action_sign_in_short"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
1
Android/BewoMitarbeiterApp/volley
Submodule
1
Android/BewoMitarbeiterApp/volley
Submodule
Submodule Android/BewoMitarbeiterApp/volley added at b1f507ab59
@@ -95,7 +95,7 @@ namespace BeWo.View
|
||||
|
||||
//####################### ServerAnwendung ############################
|
||||
|
||||
onConnectionStart();
|
||||
//onConnectionStart();
|
||||
|
||||
chatpav = new ChatView("Whats chat", chat.Text, m_workerSocketList);
|
||||
|
||||
|
||||
BIN
BeWoChatServer/bin/Debug/BS.Shared.dll
Normal file
BIN
BeWoChatServer/bin/Debug/BS.Shared.dll
Normal file
Binary file not shown.
BIN
BeWoChatServer/bin/Debug/BS.Shared.pdb
Normal file
BIN
BeWoChatServer/bin/Debug/BS.Shared.pdb
Normal file
Binary file not shown.
BIN
BeWoChatServer/bin/Debug/BeWo.Data.dll
Normal file
BIN
BeWoChatServer/bin/Debug/BeWo.Data.dll
Normal file
Binary file not shown.
BIN
BeWoChatServer/bin/Debug/BeWo.Data.pdb
Normal file
BIN
BeWoChatServer/bin/Debug/BeWo.Data.pdb
Normal file
Binary file not shown.
BIN
BeWoChatServer/bin/Debug/BeWo.Service.dll
Normal file
BIN
BeWoChatServer/bin/Debug/BeWo.Service.dll
Normal file
Binary file not shown.
BIN
BeWoChatServer/bin/Debug/BeWo.Service.pdb
Normal file
BIN
BeWoChatServer/bin/Debug/BeWo.Service.pdb
Normal file
Binary file not shown.
BIN
BeWoChatServer/bin/Debug/BeWoChatServer.exe
Normal file
BIN
BeWoChatServer/bin/Debug/BeWoChatServer.exe
Normal file
Binary file not shown.
6
BeWoChatServer/bin/Debug/BeWoChatServer.exe.config
Normal file
6
BeWoChatServer/bin/Debug/BeWoChatServer.exe.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
BIN
BeWoChatServer/bin/Debug/BeWoChatServer.pdb
Normal file
BIN
BeWoChatServer/bin/Debug/BeWoChatServer.pdb
Normal file
Binary file not shown.
BIN
BeWoChatServer/bin/Debug/BeWoChatServer.vshost.exe
Normal file
BIN
BeWoChatServer/bin/Debug/BeWoChatServer.vshost.exe
Normal file
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
11
BeWoChatServer/bin/Debug/BeWoChatServer.vshost.exe.manifest
Normal file
11
BeWoChatServer/bin/Debug/BeWoChatServer.vshost.exe.manifest
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
BIN
BeWoChatServer/bin/Debug/Castle.Core.dll
Normal file
BIN
BeWoChatServer/bin/Debug/Castle.Core.dll
Normal file
Binary file not shown.
BIN
BeWoChatServer/bin/Debug/Castle.DynamicProxy2.dll
Normal file
BIN
BeWoChatServer/bin/Debug/Castle.DynamicProxy2.dll
Normal file
Binary file not shown.
356741
BeWoChatServer/bin/Debug/ICD10/icd10.xml
Normal file
356741
BeWoChatServer/bin/Debug/ICD10/icd10.xml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
BeWoChatServer/bin/Debug/Iesi.Collections.dll
Normal file
BIN
BeWoChatServer/bin/Debug/Iesi.Collections.dll
Normal file
Binary file not shown.
BIN
BeWoChatServer/bin/Debug/MySql.Data.dll
Normal file
BIN
BeWoChatServer/bin/Debug/MySql.Data.dll
Normal file
Binary file not shown.
BIN
BeWoChatServer/bin/Debug/NHibernate.dll
Normal file
BIN
BeWoChatServer/bin/Debug/NHibernate.dll
Normal file
Binary file not shown.
BIN
BeWoChatServer/bin/Debug/Newtonsoft.Json.dll
Normal file
BIN
BeWoChatServer/bin/Debug/Newtonsoft.Json.dll
Normal file
Binary file not shown.
8558
BeWoChatServer/bin/Debug/Newtonsoft.Json.xml
Normal file
8558
BeWoChatServer/bin/Debug/Newtonsoft.Json.xml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
BeWoChatServer/bin/Debug/log4net.dll
Normal file
BIN
BeWoChatServer/bin/Debug/log4net.dll
Normal file
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\BeWoChatServer.exe.config
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\BeWoChatServer.exe
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\BeWoChatServer.pdb
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\BS.Shared.dll
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\Newtonsoft.Json.dll
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\BS.Shared.pdb
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\Newtonsoft.Json.xml
|
||||
F:\Projects\BeWo\BeWoChatServer\obj\Debug\BeWoChatServer.csprojResolveAssemblyReference.cache
|
||||
F:\Projects\BeWo\BeWoChatServer\obj\Debug\BeWoChatServer.exe
|
||||
F:\Projects\BeWo\BeWoChatServer\obj\Debug\BeWoChatServer.pdb
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\ICD10\icd10.xml
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\BeWo.Data.dll
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\BeWo.Service.dll
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\NHibernate.dll
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\MySql.Data.dll
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\log4net.dll
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\Iesi.Collections.dll
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\BeWo.Data.pdb
|
||||
F:\Projects\BeWo\BeWoChatServer\bin\Debug\BeWo.Service.pdb
|
||||
Binary file not shown.
BIN
BeWoChatServer/obj/Debug/BeWoChatServer.exe
Normal file
BIN
BeWoChatServer/obj/Debug/BeWoChatServer.exe
Normal file
Binary file not shown.
BIN
BeWoChatServer/obj/Debug/BeWoChatServer.pdb
Normal file
BIN
BeWoChatServer/obj/Debug/BeWoChatServer.pdb
Normal file
Binary file not shown.
Binary file not shown.
BIN
BeWoOhneReports.v12.suo
Normal file
BIN
BeWoOhneReports.v12.suo
Normal file
Binary file not shown.
179
Data/DefaultHibernateSessionManager.cs
Normal file
179
Data/DefaultHibernateSessionManager.cs
Normal file
@@ -0,0 +1,179 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.ServiceModel;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using log4net.Appender;
|
||||
using log4net.Layout;
|
||||
using log4net.Repository.Hierarchy;
|
||||
using NHibernate;
|
||||
using NHibernate.Cfg;
|
||||
using Environment = System.Environment;
|
||||
|
||||
namespace BeWo.Data
|
||||
{
|
||||
public class DefaultHibernateSessionManager
|
||||
{
|
||||
private static Dictionary<string, ISessionFactory> _SessionFactories = new Dictionary<string, ISessionFactory>();
|
||||
private static object _Lock = string.Empty;
|
||||
|
||||
|
||||
private static ISession currentSession;
|
||||
|
||||
public static ISession CurrentSession
|
||||
{
|
||||
get
|
||||
{
|
||||
var frame = new StackFrame(1);
|
||||
var method = frame.GetMethod();
|
||||
var callingMethodName = method.Name;
|
||||
|
||||
return currentSession ?? OpenSession();
|
||||
}
|
||||
set
|
||||
{
|
||||
currentSession = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static string CurrentTenant { get; set; }
|
||||
|
||||
private static ISessionFactory SessionFactory
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
Monitor.Enter(_Lock);
|
||||
if (!_SessionFactories.ContainsKey(CurrentTenant))
|
||||
{
|
||||
#if DEBUG
|
||||
var hierarchy = (Hierarchy)LogManager.GetRepository();
|
||||
var logger = (Logger)hierarchy.GetLogger("NHibernate.SQL");
|
||||
logger.AddAppender(new TraceAppender { Layout = new SimpleLayout() });
|
||||
hierarchy.Configured = true;
|
||||
#endif
|
||||
|
||||
var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||
var splittedBaseDirectory = baseDirectory.Split('\\'); // 0 -3
|
||||
for(var i = 0; i < 4; i++)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
_SessionFactories[CurrentTenant] = new Configuration().Configure(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Multitenancy\" + CurrentTenant + ".config")).BuildSessionFactory();
|
||||
}
|
||||
|
||||
return _SessionFactories[CurrentTenant];
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//String path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SessionFactoryError.txt");
|
||||
//System.IO.File.AppendAllText(path, String.Format("{0:dd.MM.yyyy HH:mm:ss}", DateTime.Now) + "\n" + e.Message + "\n" + e.StackTrace);
|
||||
Debug.WriteLine("<<<<< " + e.StackTrace + (e.InnerException != null ? e.InnerException.Message : string.Empty));
|
||||
throw new FaultException(e.StackTrace + e.InnerException != null ? e.InnerException.Message : string.Empty);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Monitor.Exit(_Lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static ISessionFactory RebuildSessionFactory()
|
||||
{
|
||||
ResetSessionFactory(CurrentTenant);
|
||||
|
||||
return SessionFactory;
|
||||
}
|
||||
|
||||
public static void ResetAllSessionFactories()
|
||||
{
|
||||
try
|
||||
{
|
||||
var tenants = new string[_SessionFactories.Keys.Count];
|
||||
|
||||
_SessionFactories.Keys.CopyTo(tenants, 0);
|
||||
|
||||
foreach (var item in tenants)
|
||||
{
|
||||
ResetSessionFactory(item);
|
||||
}
|
||||
|
||||
_SessionFactories = new Dictionary<string, ISessionFactory>();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//ignore?
|
||||
}
|
||||
}
|
||||
|
||||
public static void ResetSessionFactory(string tenant)
|
||||
{
|
||||
var t = tenant;
|
||||
if (string.IsNullOrEmpty(t))
|
||||
{
|
||||
t = CurrentTenant;
|
||||
}
|
||||
|
||||
if (_SessionFactories.ContainsKey(t))
|
||||
{
|
||||
try
|
||||
{
|
||||
var fact = _SessionFactories[t];
|
||||
if (!fact.IsClosed)
|
||||
{
|
||||
fact.Close();
|
||||
}
|
||||
|
||||
fact.Dispose();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//ignore exception??
|
||||
}
|
||||
|
||||
_SessionFactories.Remove(t);
|
||||
}
|
||||
}
|
||||
|
||||
public static void CloseSession()
|
||||
{
|
||||
if (currentSession != null)
|
||||
{
|
||||
currentSession.Close();
|
||||
currentSession.Dispose();
|
||||
currentSession = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static ISession OpenSession()
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
|
||||
|
||||
CloseSession();
|
||||
var session = SessionFactory.OpenSession(new UpdInsInterceptor()) ?? RebuildSessionFactory().OpenSession(new UpdInsInterceptor());
|
||||
|
||||
currentSession = session;
|
||||
|
||||
return currentSession;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new FaultException(e.StackTrace + e.InnerException != null ? e.InnerException.Message : string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool TenantExists()
|
||||
{
|
||||
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Multitenancy\" + CurrentTenant + ".config");
|
||||
|
||||
return File.Exists(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user