Free cookie consent management tool by TermsFeed Policy Generator

Changeset 403


Ignore:
Timestamp:
07/29/08 18:05:18 (16 years ago)
Author:
gkronber
Message:
  • fixed ticket #201 (Fix plugin dependencies for CEDMA plugins)
  • deleted classes DbPersistenceManager because the common code was moved to the PersistenceManager in HeuristicLab.Core.
Location:
trunk/sources
Files:
2 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Core/Agent.cs

    r394 r403  
    2929
    3030namespace HeuristicLab.CEDMA.Core {
    31   public class Agent : ItemBase, IAgent {
     31  public class Agent : IAgent {
    3232    public IDatabase Database { get; set; }
    3333    public long Id { get; set; }
     
    5555      Database.UpdateAgent(Id, Name);
    5656      Database.UpdateAgent(Id, Status);
    57       Database.UpdateAgent(Id, DbPersistenceManager.Save(this));
     57      Database.UpdateAgent(Id, PersistenceManager.SaveToGZip(OperatorGraph));
    5858    }
    5959
     
    6767        List<IAgent> agents = new List<IAgent>();
    6868        foreach(AgentEntry entry in Database.GetSubAgents(Id)) {
    69           Agent newAgent = (Agent)DbPersistenceManager.Restore(entry.RawData);
    70           newAgent.Database = Database;
    71           newAgent.Id = entry.Id;
     69          Agent newAgent = new Agent(Database, entry.Id);
    7270          newAgent.Name = entry.Name;
    7371          newAgent.Status = entry.Status;
     72          IOperatorGraph opGraph = (IOperatorGraph)PersistenceManager.RestoreFromGZip(entry.RawData);
     73          OperatorGraph.Clear();
     74          foreach(IOperator op in opGraph.Operators) OperatorGraph.AddOperator(op);
     75          OperatorGraph.InitialOperator = opGraph.InitialOperator;
    7476          agents.Add(newAgent);
    7577        }
     
    8284        List<IResult> results = new List<IResult>();
    8385        foreach(ResultEntry entry in Database.GetResults(Id)) {
    84           Result result = (Result)DbPersistenceManager.Restore(entry.RawData);
    85           result.Database = Database;
    86           result.Id = entry.Id;
     86          Result result = new Result(Database, entry.Id);
    8787          result.Summary = entry.Summary;
    8888          result.Description = entry.Description;
     89          result.Item = (IItem)PersistenceManager.RestoreFromGZip(entry.RawData);
    8990          results.Add(result);
    9091        }
     
    9394    }
    9495
    95     #region persistence
    96     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    97       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    98       node.AppendChild(PersistenceManager.Persist("OperatorGraph", operatorGraph, document, persistedObjects));
    99       return node;
    100     }
    101 
    102     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    103       base.Populate(node, restoredObjects);
    104       operatorGraph = (OperatorGraph)PersistenceManager.Restore(node.SelectSingleNode("OperatorGraph"), restoredObjects);
    105     }
    106     #endregion
    107 
    108     public override IView CreateView() {
     96    public IView CreateView() {
    10997      return new AgentView(this);
    11098    }
  • trunk/sources/HeuristicLab.CEDMA.Core/AgentList.cs

    r398 r403  
    4646      agentList.Clear();
    4747      foreach(AgentEntry a in database.GetAgents()) {
    48         Agent newAgent = (Agent)DbPersistenceManager.Restore(a.RawData);
    49         newAgent.Database = database;
    50         newAgent.Id = a.Id;
     48        Agent newAgent = new Agent(Database, a.Id);
    5149        newAgent.Name = a.Name;
    5250        newAgent.Status = a.Status;
     51        IOperatorGraph opGraph = (IOperatorGraph)PersistenceManager.RestoreFromGZip(a.RawData);
     52        foreach(IOperator op in opGraph.Operators) newAgent.OperatorGraph.AddOperator(op);
     53        newAgent.OperatorGraph.InitialOperator = opGraph.InitialOperator;
    5354        agentList.Add(newAgent);
    5455      }
     
    6667      agent.Status = ProcessStatus.Unknown;
    6768      agent.Database = database;
    68       long id = database.InsertAgent(null, agent.Name, DbPersistenceManager.Save(agent));
     69      long id = database.InsertAgent(null, agent.Name, PersistenceManager.SaveToGZip(agent.OperatorGraph));
    6970      agent.Id = id;
    7071      agentList.Add(agent);
  • trunk/sources/HeuristicLab.CEDMA.Core/AgentView.cs

    r390 r403  
    3232namespace HeuristicLab.CEDMA.Core {
    3333  public partial class AgentView : ViewBase {
     34    private IAgent agent;
    3435    public IAgent Agent {
    35       get { return (IAgent)Item; }
    36       set { base.Item = value; }
     36      get { return agent; }
     37      set { agent = value; }
    3738    }
    3839
  • trunk/sources/HeuristicLab.CEDMA.Core/HeuristicLab.CEDMA.Core.csproj

    r393 r403  
    6464    <Compile Include="Result.cs" />
    6565    <Compile Include="IResult.cs" />
    66     <Compile Include="DbPersistenceManager.cs" />
    6766    <Compile Include="HeuristicLabCedmaCorePlugin.cs" />
    6867    <Compile Include="IAgent.cs" />
  • trunk/sources/HeuristicLab.CEDMA.Core/HeuristicLabCedmaCorePlugin.cs

    r377 r403  
    3030  [Dependency(Dependency = "HeuristicLab.Core")]
    3131  [Dependency(Dependency = "HeuristicLab.CEDMA.DB.Interfaces")]
    32   [Dependency(Dependency = "HeuristicLab.CEDMA.Server")]
    3332  public class HeuristicLabCedmaCorePlugin : PluginBase {
    3433  }
  • trunk/sources/HeuristicLab.CEDMA.Core/IDatabaseItem.cs

    r393 r403  
    2828
    2929namespace HeuristicLab.CEDMA.Core {
    30   public interface IDatabaseItem : IItem {
     30  public interface IDatabaseItem {
    3131    IDatabase Database { get; set; }
    3232    long Id { get; set; }
  • trunk/sources/HeuristicLab.CEDMA.Core/Result.cs

    r394 r403  
    2929
    3030namespace HeuristicLab.CEDMA.Core {
    31   public class Result : ItemBase, IResult {
     31  public class Result : IResult {
    3232    public IDatabase Database { get; set; }
    3333    public long Id { get; set; }
     
    5050        List<IResult> results = new List<IResult>();
    5151        foreach(ResultEntry entry in Database.GetSubResults(Id)) {
    52           Result result = (Result)DbPersistenceManager.Restore(entry.RawData);
    53           result.Database = Database;
    54           result.Id = entry.Id;
     52          Result result = new Result(Database, entry.Id);
    5553          result.Summary = entry.Summary;
    5654          result.Description = entry.Description;
     55          result.Item = (IItem)PersistenceManager.RestoreFromGZip(entry.RawData);
    5756          results.Add(result);
    5857        }
     
    6160    }
    6261
    63     #region persistence
    64     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    65       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    66       node.AppendChild(PersistenceManager.Persist("Item", Item, document, persistedObjects));
    67       return node;
    68     }
    69 
    70     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    71       base.Populate(node, restoredObjects);
    72       Item = (IItem)PersistenceManager.Restore(node.SelectSingleNode("Item"), restoredObjects);
    73     }
    74     #endregion
    75 
    76     public override IView CreateView() {
     62    public IView CreateView() {
    7763      return Item.CreateView();
    7864    }
  • trunk/sources/HeuristicLab.CEDMA.Operators/HeuristicLab.CEDMA.Operators.csproj

    r394 r403  
    6363  </ItemGroup>
    6464  <ItemGroup>
    65     <ProjectReference Include="..\HeuristicLab.CEDMA.Core\HeuristicLab.CEDMA.Core.csproj">
    66       <Project>{C27DDF6C-84DF-45EF-B82F-57A28DD51166}</Project>
    67       <Name>HeuristicLab.CEDMA.Core</Name>
    68     </ProjectReference>
    6965    <ProjectReference Include="..\HeuristicLab.CEDMA.DB.Interfaces\HeuristicLab.CEDMA.DB.Interfaces.csproj">
    7066      <Project>{4F9BB789-D561-436B-B226-2BF44B7D0804}</Project>
  • trunk/sources/HeuristicLab.CEDMA.Operators/HeuristicLabCedmaOperatorsPlugin.cs

    r352 r403  
    2929  [PluginFile(Filename = "HeuristicLab.CEDMA.Operators.dll", Filetype = PluginFileType.Assembly)]
    3030  [Dependency(Dependency = "HeuristicLab.CEDMA.DB.Interfaces")]
     31  [Dependency(Dependency = "HeuristicLab.Core")]
     32  [Dependency(Dependency = "HeuristicLab.Data")]
    3133  public class HeuristicLabCedmaOperatorsPlugin : PluginBase {
    3234  }
  • trunk/sources/HeuristicLab.CEDMA.Operators/OnGridProcessor.cs

    r398 r403  
    2828using HeuristicLab.CEDMA.DB.Interfaces;
    2929using System.ServiceModel;
    30 using HeuristicLab.CEDMA.Core;
    3130
    3231namespace HeuristicLab.CEDMA.Operators {
     
    4847      long agentId = scope.GetVariableValue<IntData>("AgentId", true).Data;
    4948
    50       Agent agent = new Agent();
    51       foreach(IOperator op in operatorGraph.Operators) {
    52         agent.OperatorGraph.AddOperator(op);
    53       }
    54       agent.OperatorGraph.InitialOperator = operatorGraph.InitialOperator;
    55 
    5649      NetTcpBinding binding = new NetTcpBinding();
    5750      binding.MaxReceivedMessageSize = 10000000; // 10Mbytes
     
    6154      using(ChannelFactory<IDatabase> factory = new ChannelFactory<IDatabase>(binding)) {
    6255        IDatabase database = factory.CreateChannel(new EndpointAddress(serverUrl));
    63         long id = database.InsertAgent(agentId, null, DbPersistenceManager.Save(agent));
     56        long id = database.InsertAgent(agentId, null, PersistenceManager.SaveToGZip(operatorGraph));
    6457        database.UpdateAgent(id, ProcessStatus.Waiting);
    6558      }
  • trunk/sources/HeuristicLab.CEDMA.Operators/ScopeResultWriter.cs

    r394 r403  
    2828using HeuristicLab.CEDMA.DB.Interfaces;
    2929using System.ServiceModel;
    30 using HeuristicLab.CEDMA.Core;
    3130
    3231namespace HeuristicLab.CEDMA.Operators {
     
    4544      string serverUrl = scope.GetVariableValue<StringData>("CedmaServerUri", true).Data;
    4645      long agentId = scope.GetVariableValue<IntData>("AgentId", true).Data;
    47       Result result = new Result();
    48       result.Item = scope;
    4946
    5047      NetTcpBinding binding = new NetTcpBinding();
     
    5552      using(ChannelFactory<IDatabase> factory = new ChannelFactory<IDatabase>(binding)) {
    5653        IDatabase database = factory.CreateChannel(new EndpointAddress(serverUrl));
    57         database.InsertResult(agentId, scope.Name, "Scope", DbPersistenceManager.Save(result));
     54        database.InsertResult(agentId, scope.Name, "Scope", PersistenceManager.SaveToGZip(scope));
    5855      }
    5956      return null;
  • trunk/sources/HeuristicLab.CEDMA.Server/HeuristicLab.CEDMA.Server.csproj

    r398 r403  
    6060  <ItemGroup>
    6161    <Compile Include="RunScheduler.cs" />
    62     <Compile Include="DbPersistenceManager.cs" />
    6362    <Compile Include="ServerApplication.cs" />
    6463    <Compile Include="HeuristicLabCedmaServerPlugin.cs" />
     
    7271  </ItemGroup>
    7372  <ItemGroup>
    74     <ProjectReference Include="..\HeuristicLab.CEDMA.Core\HeuristicLab.CEDMA.Core.csproj">
    75       <Project>{C27DDF6C-84DF-45EF-B82F-57A28DD51166}</Project>
    76       <Name>HeuristicLab.CEDMA.Core</Name>
    77     </ProjectReference>
    7873    <ProjectReference Include="..\HeuristicLab.CEDMA.DB.Interfaces\HeuristicLab.CEDMA.DB.Interfaces.csproj">
    7974      <Project>{4F9BB789-D561-436B-B226-2BF44B7D0804}</Project>
     
    10095      <Name>HeuristicLab.PluginInfrastructure</Name>
    10196    </ProjectReference>
    102     <ProjectReference Include="..\HeuristicLab.SequentialEngine\HeuristicLab.SequentialEngine.csproj">
    103       <Project>{B4BE8E53-BA06-4237-9A01-24255F880201}</Project>
    104       <Name>HeuristicLab.SequentialEngine</Name>
    105     </ProjectReference>
    10697  </ItemGroup>
    10798  <ItemGroup>
  • trunk/sources/HeuristicLab.CEDMA.Server/HeuristicLabCedmaServerPlugin.cs

    r352 r403  
    2929  [PluginFile(Filename = "HeuristicLab.CEDMA.Server.dll", Filetype = PluginFileType.Assembly)]
    3030  [Dependency(Dependency = "HeuristicLab.CEDMA.DB.Interfaces")]
     31  [Dependency(Dependency = "HeuristicLab.CEDMA.DB")]
     32  [Dependency(Dependency = "HeuristicLab.Grid")]
     33  [Dependency(Dependency = "HeuristicLab.Core")]
     34  [Dependency(Dependency = "HeuristicLab.Data")]
    3135  public class HeuristicLabCedmaServerPlugin : PluginBase {
    3236  }
  • trunk/sources/HeuristicLab.CEDMA.Server/RunScheduler.cs

    r398 r403  
    2828using HeuristicLab.Core;
    2929using System.Threading;
    30 using HeuristicLab.CEDMA.Core;
    3130using HeuristicLab.Grid;
    3231using System.Diagnostics;
     
    6968      }
    7069      foreach(AgentEntry entry in agents) {
    71         Agent agent = (Agent)DbPersistenceManager.Restore(entry.RawData);
    72         IOperatorGraph opGraph = agent.OperatorGraph;
    7370        Scope scope = new Scope();
    7471        // initialize CEDMA variables for the execution of the agent
    7572        scope.AddVariable(new Variable("AgentId", new IntData((int)entry.Id)));
    7673        scope.AddVariable(new Variable("CedmaServerUri", new StringData(serverUri)));
     74        IOperatorGraph opGraph = (IOperatorGraph)PersistenceManager.RestoreFromGZip(entry.RawData);
    7775        AtomicOperation op = new AtomicOperation(opGraph.InitialOperator, scope);
    7876        WaitHandle wHandle;
Note: See TracChangeset for help on using the changeset viewer.