Changeset 925
- Timestamp:
- 12/07/08 18:03:51 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Contracts/HeuristicLab.Hive.Contracts.csproj
r902 r925 4 4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 5 5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 6 <ProductVersion>9.0. 30729</ProductVersion>6 <ProductVersion>9.0.21022</ProductVersion> 7 7 <SchemaVersion>2.0</SchemaVersion> 8 8 <ProjectGuid>{134F93D7-E7C8-4ECD-9923-7F63259A60D8}</ProjectGuid> … … 87 87 <Compile Include="Interfaces\IClientManager.cs" /> 88 88 <Compile Include="Interfaces\IJobManager.cs" /> 89 <Compile Include="Interfaces\ILifecycleManager.cs" /> 89 90 <Compile Include="Interfaces\IServerConsoleFacade.cs" /> 90 91 <Compile Include="Interfaces\IUserRoleManager.cs" /> -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/ClientAdapter.cs
r899 r925 26 26 using HeuristicLab.Hive.Server.Core.InternalInterfaces.DataAccess; 27 27 using HeuristicLab.Hive.Contracts.BusinessObjects; 28 using System.Linq.Expressions; 29 using System.Runtime.CompilerServices; 28 30 29 31 namespace HeuristicLab.Hive.Server.ADODataAccess { 30 class ClientAdapter: IClientAdapter {32 class ClientAdapter: DataAdapterBase, IClientAdapter { 31 33 private dsHiveServerTableAdapters.ClientTableAdapter adapter = 32 34 new dsHiveServerTableAdapters.ClientTableAdapter(); 33 35 34 private ResourceAdapter resAdapter = 35 new ResourceAdapter(); 36 private dsHiveServer.ClientDataTable data = 37 new dsHiveServer.ClientDataTable(); 38 39 private IResourceAdapter resAdapter = 40 ServiceLocator.GetResourceAdapter(); 41 42 public ClientAdapter() { 43 adapter.Fill(data); 44 } 45 46 protected override void Update() { 47 this.adapter.Update(this.data); 48 } 36 49 37 #region IClientAdapter Members38 50 private ClientInfo Convert(dsHiveServer.ClientRow row, 39 51 ClientInfo client) { … … 41 53 /*Parent - resource*/ 42 54 client.ResourceId = row.ResourceId; 43 resAdapter. FillResource(client);55 resAdapter.GetResourceById(client); 44 56 45 57 /*ClientInfo*/ … … 82 94 dsHiveServer.ClientRow row) { 83 95 if (client != null && row != null) { 84 row.ResourceId = client.ResourceId;85 96 row.GUID = client.ClientId; 86 97 row.CPUSpeed = client.CpuSpeedPerCore; … … 100 111 } 101 112 113 #region IClientAdapter Members 114 [MethodImpl(MethodImplOptions.Synchronized)] 102 115 public void UpdateClient(ClientInfo client) { 103 116 if (client != null) { 104 117 resAdapter.UpdateResource(client); 105 118 106 dsHiveServer.Client DataTable data =107 adapter.GetDataById(client.ClientId);119 dsHiveServer.ClientRow row = 120 data.FindByResourceId(client.ResourceId); 108 121 109 dsHiveServer.ClientRow row; 110 if (data.Count == 0) { 122 if (row == null) { 111 123 row = data.NewClientRow(); 112 124 row.ResourceId = client.ResourceId; 113 125 data.AddClientRow(row); 114 } else { 115 row = data[0]; 116 } 126 } 117 127 118 128 Convert(client, row); 119 120 adapter.Update(data);121 129 } 122 130 } … … 124 132 public ClientInfo GetClientById(Guid clientId) { 125 133 ClientInfo client = new ClientInfo(); 126 127 dsHiveServer.Client DataTable data=128 adapter.GetDataById(clientId);129 if (data.Count == 1) {130 dsHiveServer.ClientRow row = 131 data[0];134 135 dsHiveServer.ClientRow row = 136 data.Single<dsHiveServer.ClientRow>( 137 r => !r.IsGUIDNull() && r.GUID == clientId); 138 139 if (row != null) { 132 140 Convert(row, client); 133 141 … … 142 150 new List<ClientInfo>(); 143 151 144 dsHiveServer.ClientDataTable data =145 adapter.GetData();146 147 152 foreach (dsHiveServer.ClientRow row in data) { 148 153 ClientInfo client = new ClientInfo(); … … 154 159 } 155 160 161 [MethodImpl(MethodImplOptions.Synchronized)] 156 162 public bool DeleteClient(ClientInfo client) { 157 //referential integrity will delete the client object 158 return resAdapter.DeleteResource(client); 163 if (client != null) { 164 dsHiveServer.ClientRow row = 165 data.Single<dsHiveServer.ClientRow>( 166 r => r.GUID == client.ClientId); 167 168 if (row != null) { 169 data.RemoveClientRow(row); 170 171 return resAdapter.DeleteResource(client); 172 } 173 } 174 175 return false; 159 176 } 160 177 -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/HeuristicLab.Hive.Server.ADODataAccess.csproj
r910 r925 4 4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 5 5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 6 <ProductVersion>9.0. 30729</ProductVersion>6 <ProductVersion>9.0.21022</ProductVersion> 7 7 <SchemaVersion>2.0</SchemaVersion> 8 8 <ProjectGuid>{715A9134-B6E4-4CB9-8A5A-E6601497565A}</ProjectGuid> … … 66 66 <Compile Include="ClientAdapter.cs" /> 67 67 <Compile Include="ClientGroupAdapter.cs" /> 68 <Compile Include="DataAdapterBase.cs" /> 68 69 <Compile Include="dsHiveServer.cs"> 69 70 <DependentUpon>dsHiveServer.xsd</DependentUpon> … … 84 85 </Compile> 85 86 <Compile Include="ResourceAdapter.cs" /> 87 <Compile Include="TransactionManager.cs" /> 86 88 <Compile Include="UserAdapter.cs" /> 87 89 <Compile Include="UserGroupAdapter.cs" /> -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/PermissionOwnerAdapter.cs
r905 r925 27 27 using HeuristicLab.Hive.Server.Core.InternalInterfaces.DataAccess; 28 28 using HeuristicLab.Hive.Contracts.BusinessObjects; 29 using System.Runtime.CompilerServices; 29 30 30 31 namespace HeuristicLab.Hive.Server.ADODataAccess { 31 class PermissionOwnerAdapter: IPermissionOwner { 32 #region IPermissionOwner Members 32 class PermissionOwnerAdapter: DataAdapterBase, IPermissionOwnerAdapter { 33 33 private dsHiveServerTableAdapters.PermissionOwnerTableAdapter adapter = 34 34 new dsHiveServerTableAdapters.PermissionOwnerTableAdapter(); 35 35 36 private PermissionOwner Convert(dsHiveServer.PermissionOwnerRow row, 36 private dsHiveServer.PermissionOwnerDataTable data = 37 new dsHiveServer.PermissionOwnerDataTable(); 38 39 public PermissionOwnerAdapter() { 40 adapter.Fill(data); 41 } 42 43 protected override void Update() { 44 this.adapter.Update(this.data); 45 } 46 47 private PermissionOwner Convert(dsHiveServer.PermissionOwnerRow row, 37 48 PermissionOwner permOwner) { 38 49 if (row != null && permOwner != null) { … … 52 63 dsHiveServer.PermissionOwnerRow row) { 53 64 if (row != null && permOwner != null) { 54 row.PermissionOwnerId = permOwner.PermissionOwnerId;55 65 row.Name = permOwner.Name; 56 66 … … 59 69 return null; 60 70 } 61 71 72 #region IPermissionOwner Members 73 [MethodImpl(MethodImplOptions.Synchronized)] 62 74 public void UpdatePermissionOwner(PermissionOwner permOwner) { 63 75 if (permOwner != null) { 64 dsHiveServer.PermissionOwnerDataTable data = 65 adapter.GetDataById(permOwner.PermissionOwnerId); 66 67 dsHiveServer.PermissionOwnerRow row; 68 if (data.Count == 0) { 76 dsHiveServer.PermissionOwnerRow row = 77 data.FindByPermissionOwnerId(permOwner.PermissionOwnerId); 78 79 if (row == null) { 69 80 row = data.NewPermissionOwnerRow(); 70 81 data.AddPermissionOwnerRow(row); 71 } else { 72 row = data[0]; 82 83 //write row to db to get primary key 84 adapter.Update(row); 73 85 } 74 86 75 row.Name = permOwner.Name; 76 77 adapter.Update(data); 78 87 Convert(permOwner, row); 79 88 permOwner.PermissionOwnerId = row.PermissionOwnerId; 80 89 } 81 90 } 82 91 83 internal bool FillPermissionOwner(PermissionOwner permOwner) {92 public bool GetPermissionOwnerById(PermissionOwner permOwner) { 84 93 if (permOwner != null) { 85 dsHiveServer.PermissionOwnerDataTable data =86 adapter.GetDataById(permOwner.PermissionOwnerId);87 if (data.Count == 1) {88 94 dsHiveServer.PermissionOwnerRow row = 89 data[0]; 95 data.FindByPermissionOwnerId(permOwner.PermissionOwnerId); 96 97 if(row != null) { 90 98 Convert(row, permOwner); 91 99 … … 101 109 permOwner.PermissionOwnerId = permOwnerId; 102 110 103 if ( FillPermissionOwner(permOwner))111 if (GetPermissionOwnerById(permOwner)) 104 112 return permOwner; 105 113 else … … 107 115 } 108 116 117 public PermissionOwner GetPermissionOwnerByName(String name) { 118 PermissionOwner permOwner = new PermissionOwner(); 119 120 dsHiveServer.PermissionOwnerRow row = 121 data.Single<dsHiveServer.PermissionOwnerRow>( 122 r => !r.IsNameNull() && r.Name == name); 123 124 if (row != null) { 125 Convert(row, permOwner); 126 127 return permOwner; 128 } else { 129 return null; 130 } 131 } 132 109 133 public ICollection<PermissionOwner> GetAllPermissionOwners() { 110 134 ICollection<PermissionOwner> allPermissionOwners = 111 135 new List<PermissionOwner>(); 112 113 dsHiveServer.PermissionOwnerDataTable data =114 adapter.GetData();115 136 116 137 foreach (dsHiveServer.PermissionOwnerRow row in data) { … … 123 144 } 124 145 146 [MethodImpl(MethodImplOptions.Synchronized)] 125 147 public bool DeletePermissionOwner(PermissionOwner permOwner) { 126 148 if (permOwner != null) { 127 dsHiveServer.PermissionOwnerDataTable data =128 adapter.GetDataById(permOwner.PermissionOwnerId);149 dsHiveServer.PermissionOwnerRow row = 150 data.FindByPermissionOwnerId(permOwner.PermissionOwnerId); 129 151 130 if (data.Count == 1) {131 dsHiveServer.PermissionOwnerRow row = data[0];152 if(row != null) { 153 data.RemovePermissionOwnerRow(row); 132 154 133 row.Delete();134 return adapter.Update(data) > 0;155 return true; 156 } 135 157 } 136 }137 158 138 159 return false; -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/ResourceAdapter.cs
r899 r925 26 26 using HeuristicLab.Hive.Server.Core.InternalInterfaces.DataAccess; 27 27 using HeuristicLab.Hive.Contracts.BusinessObjects; 28 using System.Runtime.CompilerServices; 28 29 29 30 namespace HeuristicLab.Hive.Server.ADODataAccess { 30 class ResourceAdapter: IResourceAdapter { 31 #region IResourceAdapter Members 31 class ResourceAdapter: DataAdapterBase, IResourceAdapter { 32 32 private dsHiveServerTableAdapters.ResourceTableAdapter adapter = 33 new dsHiveServerTableAdapters.ResourceTableAdapter();33 new dsHiveServerTableAdapters.ResourceTableAdapter(); 34 34 35 private Resource Convert(dsHiveServer.ResourceRow row, 35 private dsHiveServer.ResourceDataTable data = 36 new dsHiveServer.ResourceDataTable(); 37 38 public ResourceAdapter() { 39 adapter.Fill(data); 40 } 41 42 protected override void Update() { 43 this.adapter.Update(this.data); 44 } 45 46 private Resource Convert(dsHiveServer.ResourceRow row, 36 47 Resource resource) { 37 48 if (row != null && resource != null) { … … 43 54 44 55 return resource; 45 } else 56 } else 46 57 return null; 47 58 } … … 57 68 } 58 69 70 #region IResourceAdapter Members 71 [MethodImpl(MethodImplOptions.Synchronized)] 59 72 public void UpdateResource(Resource resource) { 60 73 if (resource != null) { 61 dsHiveServer.Resource DataTable data=62 adapter.GetDataById(resource.ResourceId);74 dsHiveServer.ResourceRow row = 75 data.FindByResourceId(resource.ResourceId); 63 76 64 dsHiveServer.ResourceRow row; 65 if (data.Count == 0) { 77 if (row == null) { 66 78 row = data.NewResourceRow(); 67 79 data.AddResourceRow(row); 68 } else { 69 row = data[0]; 70 } 80 81 //write row to db to get primary key 82 adapter.Update(row); 83 } 71 84 72 85 Convert(resource, row); 73 74 adapter.Update(data);75 76 86 resource.ResourceId = row.ResourceId; 77 87 } 78 88 } 79 89 80 internal bool FillResource(Resource resource) {90 public bool GetResourceById(Resource resource) { 81 91 if (resource != null) { 82 dsHiveServer.ResourceDataTable data = 83 adapter.GetDataById(resource.ResourceId); 84 if (data.Count == 1) { 85 dsHiveServer.ResourceRow row = 86 data[0]; 92 dsHiveServer.ResourceRow row = 93 data.FindByResourceId(resource.ResourceId); 94 if (row != null) { 87 95 Convert(row, resource); 88 96 … … 98 106 resource.ResourceId = resourceId; 99 107 100 if( FillResource(resource))108 if(GetResourceById(resource)) 101 109 return resource; 102 110 else … … 105 113 106 114 public ICollection<Resource> GetAllResources() { 107 I Collection<Resource> allResources =115 IList<Resource> allResources = 108 116 new List<Resource>(); 109 110 dsHiveServer.ResourceDataTable data = 111 adapter.GetData(); 112 117 113 118 foreach (dsHiveServer.ResourceRow row in data) { 114 119 Resource resource = new Resource(); … … 120 125 } 121 126 127 [MethodImpl(MethodImplOptions.Synchronized)] 122 128 public bool DeleteResource(Resource resource) { 123 129 if(resource != null) { 130 dsHiveServer.ResourceRow row = 131 data.FindByResourceId(resource.ResourceId); 124 132 125 dsHiveServer.ResourceDataTable data =126 adapter.GetDataById(resource.ResourceId);133 if (row != null) { 134 data.RemoveResourceRow(row); 127 135 128 if (data.Count == 1) { 129 dsHiveServer.ResourceRow row = data[0]; 130 131 row.Delete(); 132 return adapter.Update(data) > 0; 136 return true; 133 137 } 134 138 } -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/UserAdapter.cs
r905 r925 27 27 using HeuristicLab.Hive.Server.Core.InternalInterfaces.DataAccess; 28 28 using HeuristicLab.Hive.Contracts.BusinessObjects; 29 using System.Runtime.CompilerServices; 29 30 30 31 namespace HeuristicLab.Hive.Server.ADODataAccess { 31 class UserAdapter :IUserAdapter {32 class UserAdapter : DataAdapterBase, IUserAdapter { 32 33 private dsHiveServerTableAdapters.HiveUserTableAdapter adapter = 33 34 new dsHiveServerTableAdapters.HiveUserTableAdapter(); 34 35 35 private PermissionOwnerAdapter permOwnerAdapter = 36 new PermissionOwnerAdapter(); 36 private dsHiveServer.HiveUserDataTable data = 37 new dsHiveServer.HiveUserDataTable(); 38 39 private IPermissionOwnerAdapter permOwnerAdapter = 40 ServiceLocator.GetPermissionOwnerAdapter(); 41 42 public UserAdapter() { 43 adapter.Fill(data); 44 } 45 46 protected override void Update() { 47 this.adapter.Update(this.data); 48 } 37 49 38 50 private User Convert(dsHiveServer.HiveUserRow row, … … 41 53 /*Parent - PermissionOwner*/ 42 54 user.PermissionOwnerId = row.PermissionOwnerId; 43 permOwnerAdapter. FillPermissionOwner(user);55 permOwnerAdapter.GetPermissionOwnerById(user); 44 56 45 57 /*User*/ … … 57 69 dsHiveServer.HiveUserRow row) { 58 70 if (user != null && row != null) { 59 row.PermissionOwnerId = user.PermissionOwnerId;60 71 row.Password = user.Password; 61 72 … … 67 78 #region IUserAdapter Members 68 79 80 [MethodImpl(MethodImplOptions.Synchronized)] 69 81 public void UpdateUser(User user) { 70 82 if (user != null) { 71 83 permOwnerAdapter.UpdatePermissionOwner(user); 72 84 73 dsHiveServer.HiveUserDataTable data = 74 adapter.GetDataById(user.PermissionOwnerId); 75 76 dsHiveServer.HiveUserRow row; 77 if (data.Count == 0) { 85 dsHiveServer.HiveUserRow row = 86 data.FindByPermissionOwnerId(user.PermissionOwnerId); 87 if (row == null) { 78 88 row = data.NewHiveUserRow(); 79 89 row.PermissionOwnerId = user.PermissionOwnerId; 80 90 data.AddHiveUserRow(row); 81 } else { 82 row = data[0]; 83 } 91 } 84 92 85 93 Convert(user, row); 86 87 adapter.Update(data);88 94 } 89 95 } … … 92 98 User user = new User(); 93 99 94 dsHiveServer.HiveUserDataTable data = 95 adapter.GetDataById(userId); 96 if (data.Count == 1) { 97 dsHiveServer.HiveUserRow row = 98 data[0]; 100 dsHiveServer.HiveUserRow row = 101 data.FindByPermissionOwnerId(userId); 102 103 if(row != null) { 99 104 Convert(row, user); 100 105 … … 108 113 User user = new User(); 109 114 110 dsHiveServer.HiveUserDataTable data = 111 adapter.GetDataByName(name); 112 if (data.Count == 1) { 115 PermissionOwner permOwner = 116 permOwnerAdapter.GetPermissionOwnerByName(name); 117 118 if (permOwner != null) { 113 119 dsHiveServer.HiveUserRow row = 114 data[0]; 115 Convert(row, user); 120 data.FindByPermissionOwnerId(permOwner.PermissionOwnerId); 116 121 117 return user; 118 } else { 119 return null; 122 if (row != null) { 123 Convert(row, user); 124 125 return user; 126 } 120 127 } 128 129 return null; 121 130 } 122 131 … … 124 133 ICollection<User> allUsers = 125 134 new List<User>(); 126 127 dsHiveServer.HiveUserDataTable data =128 adapter.GetData();129 135 130 136 foreach (dsHiveServer.HiveUserRow row in data) { … … 137 143 } 138 144 145 [MethodImpl(MethodImplOptions.Synchronized)] 139 146 public bool DeleteUser(User user) { 140 //referential integrity will delete the client object 141 return permOwnerAdapter.DeletePermissionOwner(user); 147 if (user != null) { 148 dsHiveServer.HiveUserRow row = 149 data.FindByPermissionOwnerId(user.PermissionOwnerId); 150 151 if (row != null) { 152 data.RemoveHiveUserRow(row); 153 154 return permOwnerAdapter.DeletePermissionOwner(user); 155 } 156 } 157 158 return false; 142 159 } 143 160 -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/dsHiveServer.Designer.cs
r905 r925 2 2 // <auto-generated> 3 3 // This code was generated by a tool. 4 // Runtime Version:2.0.50727. 30534 // Runtime Version:2.0.50727.1433 5 5 // 6 6 // Changes to this file may cause incorrect behavior and will be lost if … … 3628 3628 } 3629 3629 set { 3630 if (((this._resourceTableAdapter != null) 3631 && (this.TableAdapterInstanceCount == 1))) { 3632 this._resourceTableAdapter = value; 3633 return; 3634 } 3635 if (((value != null) 3636 && (this.MatchTableAdapterConnection(value.Connection) == false))) { 3637 throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + 3638 "tring."); 3639 } 3630 3640 this._resourceTableAdapter = value; 3631 3641 } … … 3641 3651 } 3642 3652 set { 3653 if (((this._clientTableAdapter != null) 3654 && (this.TableAdapterInstanceCount == 1))) { 3655 this._clientTableAdapter = value; 3656 return; 3657 } 3658 if (((value != null) 3659 && (this.MatchTableAdapterConnection(value.Connection) == false))) { 3660 throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + 3661 "tring."); 3662 } 3643 3663 this._clientTableAdapter = value; 3644 3664 } … … 3654 3674 } 3655 3675 set { 3676 if (((this._hiveUserTableAdapter != null) 3677 && (this.TableAdapterInstanceCount == 1))) { 3678 this._hiveUserTableAdapter = value; 3679 return; 3680 } 3681 if (((value != null) 3682 && (this.MatchTableAdapterConnection(value.Connection) == false))) { 3683 throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + 3684 "tring."); 3685 } 3656 3686 this._hiveUserTableAdapter = value; 3657 3687 } … … 3667 3697 } 3668 3698 set { 3699 if (((this._permissionOwnerTableAdapter != null) 3700 && (this.TableAdapterInstanceCount == 1))) { 3701 this._permissionOwnerTableAdapter = value; 3702 return; 3703 } 3704 if (((value != null) 3705 && (this.MatchTableAdapterConnection(value.Connection) == false))) { 3706 throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + 3707 "tring."); 3708 } 3669 3709 this._permissionOwnerTableAdapter = value; 3670 3710 } … … 3893 3933 return 0; 3894 3934 } 3895 if (((this._resourceTableAdapter != null)3896 && (this.MatchTableAdapterConnection(this._resourceTableAdapter.Connection) == false))) {3897 throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" +3898 "tring.");3899 }3900 if (((this._clientTableAdapter != null)3901 && (this.MatchTableAdapterConnection(this._clientTableAdapter.Connection) == false))) {3902 throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" +3903 "tring.");3904 }3905 if (((this._hiveUserTableAdapter != null)3906 && (this.MatchTableAdapterConnection(this._hiveUserTableAdapter.Connection) == false))) {3907 throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" +3908 "tring.");3909 }3910 if (((this._permissionOwnerTableAdapter != null)3911 && (this.MatchTableAdapterConnection(this._permissionOwnerTableAdapter.Connection) == false))) {3912 throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" +3913 "tring.");3914 }3915 3935 global::System.Data.IDbConnection workConnection = this.Connection; 3916 3936 if ((workConnection == null)) { … … 3919 3939 } 3920 3940 bool workConnOpened = false; 3921 if (((workConnection.State & global::System.Data.ConnectionState.Broken) 3922 == global::System.Data.ConnectionState.Broken)) { 3923 workConnection.Close(); 3924 } 3925 if ((workConnection.State == global::System.Data.ConnectionState.Closed)) { 3941 if (((workConnection.State & global::System.Data.ConnectionState.Closed) 3942 == global::System.Data.ConnectionState.Closed)) { 3926 3943 workConnection.Open(); 3927 3944 workConnOpened = true; -
trunk/sources/HeuristicLab.Hive.Server.Core/DbTestApp.cs
r905 r925 105 105 TestClientAdapter(); 106 106 TestUserAdapter(); 107 108 ITransactionManager transactionManager = 109 ServiceLocator.GetTransactionManager(); 110 111 transactionManager.UpdateDB(); 107 112 } 108 113 } -
trunk/sources/HeuristicLab.Hive.Server.Core/HeuristicLab.Hive.Server.Core.csproj
r913 r925 4 4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 5 5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 6 <ProductVersion>9.0. 30729</ProductVersion>6 <ProductVersion>9.0.21022</ProductVersion> 7 7 <SchemaVersion>2.0</SchemaVersion> 8 8 <ProjectGuid>{898B31CF-81DC-453B-AEB3-BDF83197A7EE}</ProjectGuid> … … 75 75 <Compile Include="InternalInterfaces\DataAccess\IPermissionOwnerAdapter.cs" /> 76 76 <Compile Include="InternalInterfaces\DataAccess\IResourceAdapter.cs" /> 77 <Compile Include="InternalInterfaces\DataAccess\ITransactionManager.cs" /> 77 78 <Compile Include="InternalInterfaces\DataAccess\IUserAdapter.cs" /> 78 79 <Compile Include="InternalInterfaces\DataAccess\IUserGroupAdapter.cs" /> 79 80 <Compile Include="JobManager.cs" /> 81 <Compile Include="LifecycleManager.cs" /> 80 82 <Compile Include="Properties\AssemblyInfo.cs" /> 81 83 <Compile Include="ServerConsoleFacade.cs" /> -
trunk/sources/HeuristicLab.Hive.Server.Core/InternalInterfaces/DataAccess/IPermissionOwnerAdapter.cs
r905 r925 30 30 /// The permission owner database adapter 31 31 /// </summary> 32 public interface IPermissionOwner {32 public interface IPermissionOwnerAdapter { 33 33 /// <summary> 34 34 /// Save or update the permission owner … … 38 38 39 39 /// <summary> 40 /// Gets the permission owner and updates the values of the object 41 /// </summary> 42 /// <param name="resource"></param> 43 /// <returns></returns> 44 bool GetPermissionOwnerById(PermissionOwner permOwner); 45 46 /// <summary> 40 47 /// Get the permission owner with the specified ID 41 48 /// </summary> … … 43 50 /// <returns></returns> 44 51 PermissionOwner GetPermissionOwnerById(long permOwnerId); 52 53 /// <summary> 54 /// Get the permission owner with the specified name 55 /// </summary> 56 /// <param name="clientId"></param> 57 /// <returns></returns> 58 PermissionOwner GetPermissionOwnerByName(String name); 45 59 46 60 /// <summary> -
trunk/sources/HeuristicLab.Hive.Server.Core/InternalInterfaces/DataAccess/IResourceAdapter.cs
r845 r925 45 45 46 46 /// <summary> 47 /// Gets the resource and updates the values of the object 48 /// </summary> 49 /// <param name="resource"></param> 50 /// <returns></returns> 51 bool GetResourceById(Resource resource); 52 53 /// <summary> 47 54 /// Get all resuorces 48 55 /// </summary> -
trunk/sources/HeuristicLab.Hive.Server.Core/ServerConsoleFacade.cs
r909 r925 94 94 #endregion 95 95 96 97 #region IServerConsoleFacade Members98 99 public Response Login(string userName, string password) {100 Response response = new Response();101 response.Success = true;102 return response;103 }104 105 #endregion106 96 } 107 97 } -
trunk/sources/HeuristicLab.Hive.Server.Core/ServiceLocator.cs
r910 r925 22 22 using HeuristicLab.Hive.Server.Core.InternalInterfaces.DataAccess; 23 23 using HeuristicLab.PluginInfrastructure; 24 using System.Runtime.CompilerServices; 24 25 25 26 /// <summary> 26 27 /// The service locator for the server core 27 28 /// </summary> 28 class ServiceLocator {29 public class ServiceLocator { 29 30 private static DiscoveryService discoveryService = 30 31 new DiscoveryService(); 32 33 private static ITransactionManager transManager = null; 31 34 32 35 private static IClientAdapter clientAdapter = null; … … 34 37 private static IClientGroupAdapter clientGroupAdapter = null; 35 38 39 private static IResourceAdapter resourceAdapter = null; 40 36 41 private static IUserAdapter userAdapter = null; 37 42 38 43 private static IUserGroupAdapter userGroupAdapter = null; 39 44 45 private static IPermissionOwnerAdapter permOwnerAdapter = null; 46 47 /// <summary> 48 /// Gets the db transaction manager 49 /// </summary> 50 /// <returns></returns> 51 [MethodImpl(MethodImplOptions.Synchronized)] 52 public static ITransactionManager GetTransactionManager() { 53 if (transManager == null) { 54 transManager = discoveryService.GetInstances<ITransactionManager>()[0]; 55 } 56 57 return transManager; 58 } 59 40 60 /// <summary> 41 61 /// Gets the client database adapter 42 62 /// </summary> 43 63 /// <returns></returns> 44 internal static IClientAdapter GetClientAdapter() { 64 [MethodImpl(MethodImplOptions.Synchronized)] 65 public static IClientAdapter GetClientAdapter() { 45 66 if (clientAdapter == null) { 46 67 clientAdapter = discoveryService.GetInstances<IClientAdapter>()[0]; … … 54 75 /// </summary> 55 76 /// <returns></returns> 56 internal static IClientGroupAdapter GetClientGroupAdapter() { 77 [MethodImpl(MethodImplOptions.Synchronized)] 78 public static IClientGroupAdapter GetClientGroupAdapter() { 57 79 if (clientGroupAdapter == null) { 58 80 clientGroupAdapter = discoveryService.GetInstances<IClientGroupAdapter>()[0]; … … 63 85 64 86 /// <summary> 87 /// Gets the resource database adapter 88 /// </summary> 89 /// <returns></returns> 90 [MethodImpl(MethodImplOptions.Synchronized)] 91 public static IResourceAdapter GetResourceAdapter() { 92 if (resourceAdapter == null) { 93 resourceAdapter = discoveryService.GetInstances<IResourceAdapter>()[0]; 94 } 95 96 return resourceAdapter; 97 } 98 99 /// <summary> 65 100 /// Gets the user database adapter 66 101 /// </summary> 67 102 /// <returns></returns> 68 internal static IUserAdapter GetUserAdapter() { 103 [MethodImpl(MethodImplOptions.Synchronized)] 104 public static IUserAdapter GetUserAdapter() { 69 105 if (userAdapter == null) { 70 106 userAdapter = discoveryService.GetInstances<IUserAdapter>()[0]; … … 78 114 /// </summary> 79 115 /// <returns></returns> 80 internal static IUserGroupAdapter GetUserGroupAdapter() { 116 [MethodImpl(MethodImplOptions.Synchronized)] 117 public static IUserGroupAdapter GetUserGroupAdapter() { 81 118 if (userGroupAdapter == null) { 82 119 userGroupAdapter = discoveryService.GetInstances<IUserGroupAdapter>()[0]; … … 85 122 return userGroupAdapter; 86 123 } 124 125 /// <summary> 126 /// Gets the permission owner database adapter 127 /// </summary> 128 /// <returns></returns> 129 [MethodImpl(MethodImplOptions.Synchronized)] 130 public static IPermissionOwnerAdapter GetPermissionOwnerAdapter() { 131 if (permOwnerAdapter == null) { 132 permOwnerAdapter = discoveryService.GetInstances<IPermissionOwnerAdapter>()[0]; 133 } 134 135 return permOwnerAdapter; 136 } 87 137 } -
trunk/sources/HeuristicLab.Hive.Server/HiveServerApplication.cs
r805 r925 88 88 if (serverConsoleInstances.Length > 0) { 89 89 ServiceHost serviceHost = 90 90 new ServiceHost(serverConsoleInstances[0].GetType(), 91 91 uriTcp); 92 92 … … 139 139 StartServerConsoleFacade(uriTcp); 140 140 141 Form mainForm = new MainForm(clientCommunicator.BaseAddresses[0],142 serverConsoleFacade.BaseAddresses[0]);141 ILifecycleManager[] lifecycleManagers = 142 discService.GetInstances<ILifecycleManager>(); 143 143 144 Application.Run(mainForm); 144 if (lifecycleManagers.Length > 0) { 145 ILifecycleManager lifecycleManager = 146 lifecycleManagers[0]; 147 148 lifecycleManager.Init(); 149 150 Form mainForm = new MainForm(clientCommunicator.BaseAddresses[0], 151 serverConsoleFacade.BaseAddresses[0]); 152 153 Application.Run(mainForm); 154 155 lifecycleManager.Shtudown(); 156 } 145 157 146 158 clientCommunicator.Close(); 147 159 serverConsoleFacade.Close(); 160 161 148 162 } 149 163 }
Note: See TracChangeset
for help on using the changeset viewer.