Changeset 1580
- Timestamp:
- 04/16/09 17:46:11 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 16 added
- 4 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/DataAdapterBase.cs
r1529 r1580 36 36 private ISession session; 37 37 38 private I DataAdapterWrapper<AdapterT, ObjT, RowT> dataAdapter;38 private ITableAdapterWrapper<AdapterT, ObjT, RowT> dataAdapter; 39 39 40 40 protected DataAdapterBase( 41 I DataAdapterWrapper<AdapterT, ObjT, RowT> dataAdapter) {41 ITableAdapterWrapper<AdapterT, ObjT, RowT> dataAdapter) { 42 42 this.dataAdapter = dataAdapter; 43 43 } … … 49 49 } 50 50 51 protected I DataAdapterWrapper<AdapterT, ObjT, RowT> DataAdapterWrapper {51 protected ITableAdapterWrapper<AdapterT, ObjT, RowT> DataAdapterWrapper { 52 52 get { 53 53 return dataAdapter; -
trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/HeuristicLab.DataAccess.ADOHelper-3.2.csproj
r1534 r1580 83 83 <Compile Include="DataAccessADOHelperPlugin.cs" /> 84 84 <Compile Include="DataAdapterBase.cs" /> 85 <Compile Include=" DataAdapterWrapperBase.cs" />86 <Compile Include="I DataAdapterWrapper.cs" />87 <Compile Include=" BinaryRelation.cs" />88 <Compile Include=" BinaryRelationHelper.cs" />85 <Compile Include="TableAdapterWrapperBase.cs" /> 86 <Compile Include="ITableAdapterWrapper.cs" /> 87 <Compile Include="ManyToManyRelation.cs" /> 88 <Compile Include="ManyToManyRelationHelper.cs" /> 89 89 <Compile Include="Session.cs" /> 90 90 <Compile Include="SessionFactory.cs" /> -
trunk/sources/HeuristicLab.Hive.Contracts/3.2/BusinessObjects/Job.cs
r1478 r1580 55 55 public int MemoryNeeded { get; set; } 56 56 [DataMember] 57 public List< PluginInfo> PluginsNeeded { get; set; }57 public List<HivePluginInfo> PluginsNeeded { get; set; } 58 58 } 59 59 } -
trunk/sources/HeuristicLab.Hive.Contracts/3.2/HeuristicLab.Hive.Contracts-3.2.csproj
r1534 r1580 88 88 <Compile Include="ApplicationConstants.cs" /> 89 89 <Compile Include="BusinessObjects\ClientGroup.cs" /> 90 <Compile Include="BusinessObjects\HivePluginInfo.cs" /> 90 91 <Compile Include="BusinessObjects\HeartBeatData.cs" /> 91 92 <Compile Include="BusinessObjects\Job.cs" /> -
trunk/sources/HeuristicLab.Hive.Engine/3.2/HiveEngine.cs
r1530 r1580 29 29 using HeuristicLab.Hive.Contracts; 30 30 using HeuristicLab.PluginInfrastructure; 31 using HeuristicLab.Hive.Contracts.BusinessObjects; 31 32 32 33 namespace HeuristicLab.Hive.Engine { … … 81 82 jobObj.SerializedJob = PersistenceManager.SaveToGZip(job); 82 83 jobObj.State = HeuristicLab.Hive.Contracts.BusinessObjects.State.offline; 83 jobObj.PluginsNeeded = dependentPlugins; 84 85 List<HivePluginInfo> pluginsNeeded = 86 new List<HivePluginInfo>(); 87 88 foreach (PluginInfo info in dependentPlugins) { 89 HivePluginInfo pluginInfo = 90 new HivePluginInfo(); 91 pluginInfo.Name = info.Name; 92 pluginInfo.Version = info.Version.ToString(); 93 pluginInfo.BuildDate = info.BuildDate.ToString(); 94 95 pluginsNeeded.Add(pluginInfo); 96 } 97 98 jobObj.PluginsNeeded = pluginsNeeded; 84 99 ResponseObject<Contracts.BusinessObjects.Job> res = executionEngineFacade.AddJob(jobObj); 85 100 jobId = res.Obj.Id; -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ClientAdapter.cs
r1530 r1580 32 32 using System.Data.Common; 33 33 using System.Data.SqlClient; 34 using HeuristicLab.Hive.Server.ADODataAccess.TableAdapterWrapper; 34 35 35 36 namespace HeuristicLab.Hive.Server.ADODataAccess { 36 class ClientAdapterWrapper :37 DataAdapterWrapperBase<38 dsHiveServerTableAdapters.ClientTableAdapter,39 ClientInfo,40 dsHiveServer.ClientRow> {41 public override void UpdateRow(dsHiveServer.ClientRow row) {42 TransactionalAdapter.Update(row);43 }44 45 public override dsHiveServer.ClientRow46 InsertNewRow(ClientInfo client) {47 dsHiveServer.ClientDataTable data =48 new dsHiveServer.ClientDataTable();49 50 dsHiveServer.ClientRow row = data.NewClientRow();51 row.ResourceId = client.Id;52 data.AddClientRow(row);53 54 return row;55 }56 57 public override IEnumerable<dsHiveServer.ClientRow>58 FindById(Guid id) {59 return TransactionalAdapter.GetDataById(id);60 }61 62 public override IEnumerable<dsHiveServer.ClientRow>63 FindAll() {64 return TransactionalAdapter.GetData();65 }66 67 protected override void SetConnection(DbConnection connection) {68 adapter.Connection = connection as SqlConnection;69 }70 71 protected override void SetTransaction(DbTransaction transaction) {72 adapter.Transaction = transaction as SqlTransaction;73 }74 }75 76 37 class ClientAdapter: 77 38 DataAdapterBase< -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ClientGroupAdapter.cs
r1530 r1580 32 32 using System.Data.Common; 33 33 using System.Data.SqlClient; 34 using HeuristicLab.Hive.Server.ADODataAccess.TableAdapterWrapper; 34 35 35 36 namespace HeuristicLab.Hive.Server.ADODataAccess { 36 class ClientGroupAdapterWrapper :37 DataAdapterWrapperBase<dsHiveServerTableAdapters.ClientGroupTableAdapter,38 ClientGroup,39 dsHiveServer.ClientGroupRow> {40 public override dsHiveServer.ClientGroupRow41 InsertNewRow(ClientGroup group) {42 dsHiveServer.ClientGroupDataTable data =43 new dsHiveServer.ClientGroupDataTable();44 45 dsHiveServer.ClientGroupRow row =46 data.NewClientGroupRow();47 48 row.ResourceId = group.Id;49 50 data.AddClientGroupRow(row);51 TransactionalAdapter.Update(row);52 53 return row;54 }55 56 public override void57 UpdateRow(dsHiveServer.ClientGroupRow row) {58 TransactionalAdapter.Update(row);59 }60 61 public override IEnumerable<dsHiveServer.ClientGroupRow>62 FindById(Guid id) {63 return TransactionalAdapter.GetDataById(id);64 }65 66 public override IEnumerable<dsHiveServer.ClientGroupRow>67 FindAll() {68 return TransactionalAdapter.GetData();69 }70 71 protected override void SetConnection(DbConnection connection) {72 adapter.Connection = connection as SqlConnection;73 }74 75 protected override void SetTransaction(DbTransaction transaction) {76 adapter.Transaction = transaction as SqlTransaction;77 }78 }79 80 class ClientGroup_ResourceAdapterWrapper :81 DataAdapterWrapperBase<dsHiveServerTableAdapters.ClientGroup_ResourceTableAdapter,82 BinaryRelation,83 dsHiveServer.ClientGroup_ResourceRow> {84 public override dsHiveServer.ClientGroup_ResourceRow85 InsertNewRow(BinaryRelation relation) {86 dsHiveServer.ClientGroup_ResourceDataTable data =87 new dsHiveServer.ClientGroup_ResourceDataTable();88 89 dsHiveServer.ClientGroup_ResourceRow row =90 data.NewClientGroup_ResourceRow();91 92 row.ClientGroupId = relation.Id;93 row.ResourceId = relation.Id2;94 95 data.AddClientGroup_ResourceRow(row);96 TransactionalAdapter.Update(row);97 98 return row;99 }100 101 public override void102 UpdateRow(dsHiveServer.ClientGroup_ResourceRow row) {103 TransactionalAdapter.Update(row);104 }105 106 public override IEnumerable<dsHiveServer.ClientGroup_ResourceRow>107 FindById(Guid id) {108 return TransactionalAdapter.GetDataByClientGroupId(id);109 }110 111 public override IEnumerable<dsHiveServer.ClientGroup_ResourceRow>112 FindAll() {113 return TransactionalAdapter.GetData();114 }115 116 protected override void SetConnection(DbConnection connection) {117 adapter.Connection = connection as SqlConnection;118 }119 120 protected override void SetTransaction(DbTransaction transaction) {121 adapter.Transaction = transaction as SqlTransaction;122 }123 }124 125 37 class ClientGroupAdapter : 126 38 DataAdapterBase<dsHiveServerTableAdapters.ClientGroupTableAdapter, … … 129 41 IClientGroupAdapter { 130 42 #region Fields 131 private BinaryRelationHelper<43 private ManyToManyRelationHelper< 132 44 dsHiveServerTableAdapters.ClientGroup_ResourceTableAdapter, 133 dsHiveServer.ClientGroup_ResourceRow> binaryRelationHelper = null;45 dsHiveServer.ClientGroup_ResourceRow> manyToManyRelationHelper = null; 134 46 135 private BinaryRelationHelper<dsHiveServerTableAdapters.ClientGroup_ResourceTableAdapter,136 dsHiveServer.ClientGroup_ResourceRow> BinaryRelationHelper {47 private ManyToManyRelationHelper<dsHiveServerTableAdapters.ClientGroup_ResourceTableAdapter, 48 dsHiveServer.ClientGroup_ResourceRow> ManyToManyRelationHelper { 137 49 get { 138 if ( binaryRelationHelper == null) {139 binaryRelationHelper =140 new BinaryRelationHelper<dsHiveServerTableAdapters.ClientGroup_ResourceTableAdapter,50 if (manyToManyRelationHelper == null) { 51 manyToManyRelationHelper = 52 new ManyToManyRelationHelper<dsHiveServerTableAdapters.ClientGroup_ResourceTableAdapter, 141 53 dsHiveServer.ClientGroup_ResourceRow>(new ClientGroup_ResourceAdapterWrapper()); 142 54 } 143 55 144 binaryRelationHelper.Session = Session as Session;56 manyToManyRelationHelper.Session = Session as Session; 145 57 146 return binaryRelationHelper;58 return manyToManyRelationHelper; 147 59 } 148 60 } … … 186 98 187 99 ICollection<Guid> resources = 188 BinaryRelationHelper.GetRelationships(clientGroup.Id);100 ManyToManyRelationHelper.GetRelationships(clientGroup.Id); 189 101 190 102 clientGroup.Resources.Clear(); … … 240 152 } 241 153 242 BinaryRelationHelper.UpdateRelationships(group.Id,154 ManyToManyRelationHelper.UpdateRelationships(group.Id, 243 155 relationships); 244 156 } … … 264 176 if (group != null) { 265 177 //delete all relationships 266 BinaryRelationHelper.UpdateRelationships(group.Id,178 ManyToManyRelationHelper.UpdateRelationships(group.Id, 267 179 new List<Guid>()); 268 180 -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/HeuristicLab.Hive.Server.ADODataAccess-3.2.csproj
r1534 r1580 94 94 <Compile Include="JobAdapter.cs" /> 95 95 <Compile Include="JobResultsAdapter.cs" /> 96 <Compile Include="PluginInfoAdapter.cs" /> 96 97 <Compile Include="Properties\AssemblyInfo.cs" /> 97 98 <Compile Include="Properties\Settings.Designer.cs"> … … 101 102 </Compile> 102 103 <Compile Include="ResourceAdapter.cs" /> 104 <Compile Include="TableAdapterWrapper\ClientAdapterWrapper.cs" /> 105 <Compile Include="TableAdapterWrapper\ClientGroupAdapterWrapper.cs" /> 106 <Compile Include="TableAdapterWrapper\ClientGroup_ResourceAdapterWrapper.cs" /> 107 <Compile Include="TableAdapterWrapper\RequiredPluginsAdapterWrapper.cs" /> 108 <Compile Include="TableAdapterWrapper\PluginInfoAdapterWrapper.cs" /> 109 <Compile Include="TableAdapterWrapper\ResourceAdapterWrapper.cs" /> 110 <Compile Include="TableAdapterWrapper\JobResultsAdapterWrapper.cs" /> 111 <Compile Include="TableAdapterWrapper\JobAdapterWrapper.cs" /> 103 112 </ItemGroup> 104 113 <ItemGroup> -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/JobAdapter.cs
r1530 r1580 31 31 using System.Data.Common; 32 32 using System.Data.SqlClient; 33 using HeuristicLab.Hive.Server.ADODataAccess.TableAdapterWrapper; 33 34 34 35 namespace HeuristicLab.Hive.Server.ADODataAccess { 35 class JobAdapterWrapper :36 DataAdapterWrapperBase<dsHiveServerTableAdapters.JobTableAdapter,37 Job,38 dsHiveServer.JobRow> {39 public override void UpdateRow(dsHiveServer.JobRow row) {40 TransactionalAdapter.Update(row);41 }42 43 public override dsHiveServer.JobRow44 InsertNewRow(Job job) {45 dsHiveServer.JobDataTable data =46 new dsHiveServer.JobDataTable();47 48 dsHiveServer.JobRow row = data.NewJobRow();49 row.JobId = job.Id;50 data.AddJobRow(row);51 52 return row;53 }54 55 public override IEnumerable<dsHiveServer.JobRow>56 FindById(Guid id) {57 return TransactionalAdapter.GetDataById(id);58 }59 60 public override IEnumerable<dsHiveServer.JobRow>61 FindAll() {62 return TransactionalAdapter.GetData();63 }64 65 protected override void SetConnection(DbConnection connection) {66 adapter.Connection = connection as SqlConnection;67 }68 69 protected override void SetTransaction(DbTransaction transaction) {70 adapter.Transaction = transaction as SqlTransaction;71 }72 }73 74 36 class JobAdapter : 75 37 DataAdapterBase<dsHiveServerTableAdapters.JobTableAdapter, … … 78 40 IJobAdapter { 79 41 #region Fields 42 private ManyToManyRelationHelper< 43 dsHiveServerTableAdapters.RequiredPluginsTableAdapter, 44 dsHiveServer.RequiredPluginsRow> manyToManyRelationHelper = null; 45 46 private ManyToManyRelationHelper< 47 dsHiveServerTableAdapters.RequiredPluginsTableAdapter, 48 dsHiveServer.RequiredPluginsRow> ManyToManyRelationHelper { 49 get { 50 if (manyToManyRelationHelper == null) { 51 manyToManyRelationHelper = 52 new ManyToManyRelationHelper<dsHiveServerTableAdapters.RequiredPluginsTableAdapter, 53 dsHiveServer.RequiredPluginsRow>(new RequiredPluginsAdapterWrapper()); 54 } 55 56 manyToManyRelationHelper.Session = Session as Session; 57 58 return manyToManyRelationHelper; 59 } 60 } 61 80 62 private IClientAdapter clientAdapter = null; 81 63 … … 102 84 } 103 85 } 86 87 private IPluginInfoAdapter pluginInfoAdapter = null; 88 89 private IPluginInfoAdapter PluginInfoAdapter { 90 get { 91 if (pluginInfoAdapter == null) { 92 pluginInfoAdapter = 93 this.Session.GetDataAdapter<HivePluginInfo, IPluginInfoAdapter>(); 94 } 95 96 return pluginInfoAdapter; 97 } 98 } 104 99 #endregion 105 100 … … 167 162 else 168 163 job.MemoryNeeded = default(int); 164 165 ICollection<Guid> requiredPlugins = 166 ManyToManyRelationHelper.GetRelationships(job.Id); 167 168 job.PluginsNeeded.Clear(); 169 foreach (Guid requiredPlugin in requiredPlugins) { 170 HivePluginInfo pluginInfo = 171 PluginInfoAdapter.GetById(requiredPlugin); 172 173 job.PluginsNeeded.Add(pluginInfo); 174 } 169 175 170 176 return job; … … 296 302 } 297 303 304 protected override void doUpdate(Job obj) { 305 base.doUpdate(obj); 306 307 //update relationships 308 List<Guid> relationships = 309 new List<Guid>(); 310 foreach (HivePluginInfo pluginInfo in obj.PluginsNeeded) { 311 PluginInfoAdapter.Update(pluginInfo); 312 relationships.Add(pluginInfo.Id); 313 } 314 315 ManyToManyRelationHelper.UpdateRelationships( 316 obj.Id, relationships); 317 } 318 298 319 protected override bool doDelete(Job job) { 299 320 if (job != null) { … … 310 331 } 311 332 333 //delete all relationships 334 ManyToManyRelationHelper.UpdateRelationships(job.Id, 335 new List<Guid>()); 336 312 337 return base.doDelete(job); 313 338 } -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/JobResultsAdapter.cs
r1530 r1580 9 9 using System.Data.Common; 10 10 using System.Data.SqlClient; 11 using HeuristicLab.Hive.Server.ADODataAccess.TableAdapterWrapper; 11 12 12 13 namespace HeuristicLab.Hive.Server.ADODataAccess { 13 class JobResultsAdapterWrapper :14 DataAdapterWrapperBase<dsHiveServerTableAdapters.JobResultTableAdapter,15 JobResult,16 dsHiveServer.JobResultRow> {17 public override void UpdateRow(dsHiveServer.JobResultRow row) {18 TransactionalAdapter.Update(row);19 }20 21 public override dsHiveServer.JobResultRow InsertNewRow(JobResult obj) {22 dsHiveServer.JobResultDataTable data =23 new dsHiveServer.JobResultDataTable();24 25 dsHiveServer.JobResultRow row = data.NewJobResultRow();26 row.JobResultId = obj.Id;27 data.AddJobResultRow(row);28 29 return row;30 }31 32 public override IEnumerable<dsHiveServer.JobResultRow> FindById(Guid id) {33 return TransactionalAdapter.GetDataById(id);34 }35 36 public override IEnumerable<dsHiveServer.JobResultRow> FindAll() {37 return TransactionalAdapter.GetData();38 }39 40 protected override void SetConnection(DbConnection connection) {41 adapter.Connection = connection as SqlConnection;42 }43 44 protected override void SetTransaction(DbTransaction transaction) {45 adapter.Transaction = transaction as SqlTransaction;46 }47 }48 49 14 class JobResultsAdapter: 50 15 DataAdapterBase<dsHiveServerTableAdapters.JobResultTableAdapter, -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ResourceAdapter.cs
r1530 r1580 30 30 using System.Data.Common; 31 31 using System.Data.SqlClient; 32 using HeuristicLab.Hive.Server.ADODataAccess.TableAdapterWrapper; 32 33 33 34 namespace HeuristicLab.Hive.Server.ADODataAccess { 34 class ResourceAdapterWrapper :35 DataAdapterWrapperBase<36 dsHiveServerTableAdapters.ResourceTableAdapter,37 Resource,38 dsHiveServer.ResourceRow> {39 public override void UpdateRow(dsHiveServer.ResourceRow row) {40 TransactionalAdapter.Update(row);41 }42 43 public override dsHiveServer.ResourceRow44 InsertNewRow(Resource resource) {45 dsHiveServer.ResourceDataTable data =46 new dsHiveServer.ResourceDataTable();47 48 dsHiveServer.ResourceRow row = data.NewResourceRow();49 row.ResourceId = resource.Id;50 data.AddResourceRow(row);51 52 return row;53 }54 55 public override IEnumerable<dsHiveServer.ResourceRow>56 FindById(Guid id) {57 return TransactionalAdapter.GetDataById(id);58 }59 60 public override IEnumerable<dsHiveServer.ResourceRow>61 FindAll() {62 return TransactionalAdapter.GetData();63 }64 65 protected override void SetConnection(DbConnection connection) {66 adapter.Connection = connection as SqlConnection;67 }68 69 protected override void SetTransaction(DbTransaction transaction) {70 adapter.Transaction = transaction as SqlTransaction;71 }72 }73 74 35 class ResourceAdapter: 75 36 DataAdapterBase< -
trunk/sources/HeuristicLab.Hive.Server.DataAccess/3.2/HeuristicLab.Hive.Server.DataAccess-3.2.csproj
r1534 r1580 76 76 --> 77 77 <ItemGroup> 78 <Compile Include="IPluginInfoAdapter.cs" /> 78 79 <Compile Include="Properties\AssemblyInfo.cs" /> 79 80 <Compile Include="HiveServerDataAccessPlugin.cs" />
Note: See TracChangeset
for help on using the changeset viewer.