<Activity mc:Ignorable="sap" x:Class="Jhu.Graywulf.Jobs.MirrorDatabase.MirrorDatabaseJob" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:jga="clr-namespace:Jhu.Graywulf.Activities;assembly=Jhu.Graywulf.Activities" xmlns:jgr="clr-namespace:Jhu.Graywulf.Registry;assembly=Jhu.Graywulf.Registry" xmlns:jgra="clr-namespace:Jhu.Graywulf.Activities;assembly=Jhu.Graywulf.Registry" xmlns:local="clr-namespace:Jhu.Graywulf.Jobs.MirrorDatabase" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=System.Xml" xmlns:s3="clr-namespace:System;assembly=System.Core" xmlns:s4="clr-namespace:System;assembly=System.ServiceModel" xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:sc="clr-namespace:System.Collections;assembly=mscorlib" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <x:Members>
    <x:Property Name="UserGuid" Type="InArgument(s:Guid)" />
    <x:Property Name="JobGuid" Type="InArgument(s:Guid)" />
    <x:Property Name="DatabaseVersionName" Type="InArgument(x:String)" />
  </x:Members>
  <sap:VirtualizedContainerService.HintSize>445,1703</sap:VirtualizedContainerService.HintSize>
  <mva:VisualBasic.Settings>Assembly references and imported namespaces for internal implementation</mva:VisualBasic.Settings>
  <Sequence DisplayName="MirrorDatabase" sad:XamlDebuggerXmlReader.FileName="C:\Users\dobos\Documents\Visual Studio 2010\Projects\Graywulf\Jhu.Graywulf.Jobs\MirrorDatabase\MirrorDatabaseJob.xaml" sap:VirtualizedContainerService.HintSize="405,1663">
    <Sequence.Variables>
      <Variable x:TypeArguments="scg:Queue(s:Guid)" Name="SourceDatabaseInstanceGuids" />
      <Variable x:TypeArguments="scg:Queue(s:Guid)" Name="DestinationDatabaseInstanceGuids" />
    </Sequence.Variables>
    <sap:WorkflowViewStateService.ViewState>
      <scg3:Dictionary x:TypeArguments="x:String, x:Object">
        <x:Boolean x:Key="IsExpanded">True</x:Boolean>
      </scg3:Dictionary>
    </sap:WorkflowViewStateService.ViewState>
      <Sequence DisplayName="Init Sequence" sap:VirtualizedContainerService.HintSize="222,146">
        <sap:WorkflowViewStateService.ViewState>
          <scg3:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg3:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
        <local:FindSourcesAndDestinations DestinationDatabaseInstanceGuids="[DestinationDatabaseInstanceGuids]" sap:VirtualizedContainerService.HintSize="200,22" JobGuid="[JobGuid]" DatabaseVersionName="[DatabaseVersionName]" SourceDatabaseInstanceGuids="[SourceDatabaseInstanceGuids]" UserGuid="[UserGuid]" />
      </Sequence>
      <ParallelForEach x:TypeArguments="s:Guid" DisplayName="ParallelForEach DestinationDatabaseInstance" sap:VirtualizedContainerService.HintSize="369,1281" Values="[DestinationDatabaseInstanceGuids]">
        <sap:WorkflowViewStateService.ViewState>
          <scg3:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
            <x:Boolean x:Key="IsPinned">False</x:Boolean>
          </scg3:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
        <ActivityAction x:TypeArguments="s:Guid">
          <ActivityAction.Argument>
            <DelegateInArgument x:TypeArguments="s:Guid" Name="databaseInstanceGuid" />
          </ActivityAction.Argument>
          <Sequence DisplayName="MirrorDatabaseInstance" sap:VirtualizedContainerService.HintSize="339,1175">
            <Sequence.Variables>
              <Variable x:TypeArguments="s:Guid" Default="[Guid.Empty]" Name="SourceDatabaseInstanceGuid" />
              <Variable x:TypeArguments="s:Guid" Default="[databaseInstanceGuid]" Name="DestinationDatabaseInstanceGuid" />
              <Variable x:TypeArguments="scg3:Dictionary(s:Guid, scg3:List(s:Guid))" Name="SourceDatabaseInstanceFileGuids" />
            </Sequence.Variables>
            <sap:WorkflowViewStateService.ViewState>
              <scg3:Dictionary x:TypeArguments="x:String, x:Object">
                <x:Boolean x:Key="IsExpanded">True</x:Boolean>
                <x:Boolean x:Key="IsPinned">False</x:Boolean>
              </scg3:Dictionary>
            </sap:WorkflowViewStateService.ViewState>
            <Flowchart DisplayName="DequeueSourceDatabaseInstance" sap:VirtualizedContainerService.HintSize="317,51">
              <sap:WorkflowViewStateService.ViewState>
                <scg3:Dictionary x:TypeArguments="x:String, x:Object">
                  <x:Boolean x:Key="IsExpanded">False</x:Boolean>
                  <av:Point x:Key="ShapeLocation">270,2.5</av:Point>
                  <av:Size x:Key="ShapeSize">60,75</av:Size>
                  <av:PointCollection x:Key="ConnectorLocation">300,77.5 300,107.5 300,129</av:PointCollection>
                </scg3:Dictionary>
              </sap:WorkflowViewStateService.ViewState>
              <Flowchart.StartNode>
                <FlowStep x:Name="__ReferenceID0">
                  <sap:WorkflowViewStateService.ViewState>
                    <scg3:Dictionary x:TypeArguments="x:String, x:Object">
                      <av:Point x:Key="ShapeLocation">200,129</av:Point>
                      <av:Size x:Key="ShapeSize">200,22</av:Size>
                      <av:PointCollection x:Key="ConnectorLocation">300,151 300,181 300,202.5</av:PointCollection>
                    </scg3:Dictionary>
                  </sap:WorkflowViewStateService.ViewState>
                  <jga:DequeueItem x:TypeArguments="s:Guid" sap:VirtualizedContainerService.HintSize="200,22" InputQueue="[SourceDatabaseInstanceGuids]" Result="[SourceDatabaseInstanceGuid]" />
                  <FlowStep.Next>
                    <FlowDecision x:Name="__ReferenceID1" Condition="[SourceDatabaseInstanceGuid = Guid.Empty]" sap:VirtualizedContainerService.HintSize="60,75">
                      <sap:WorkflowViewStateService.ViewState>
                        <scg3:Dictionary x:TypeArguments="x:String, x:Object">
                          <av:Point x:Key="ShapeLocation">270,202.5</av:Point>
                          <av:Size x:Key="ShapeSize">60,75</av:Size>
                          <av:PointCollection x:Key="TrueConnector">270,240 160,240 160,319</av:PointCollection>
                        </scg3:Dictionary>
                      </sap:WorkflowViewStateService.ViewState>
                      <FlowDecision.True>
                        <FlowStep x:Name="__ReferenceID2">
                          <sap:WorkflowViewStateService.ViewState>
                            <scg3:Dictionary x:TypeArguments="x:String, x:Object">
                              <av:Point x:Key="ShapeLocation">60,319</av:Point>
                              <av:Size x:Key="ShapeSize">200,22</av:Size>
                              <av:PointCollection x:Key="ConnectorLocation">60,330 30,330 30,140 200,140</av:PointCollection>
                            </scg3:Dictionary>
                          </sap:WorkflowViewStateService.ViewState>
                          <Delay Duration="00:00:05" sap:VirtualizedContainerService.HintSize="200,22" />
                          <FlowStep.Next>
                            <x:Reference>__ReferenceID0</x:Reference>
                          </FlowStep.Next>
                        </FlowStep>
                      </FlowDecision.True>
                    </FlowDecision>
                  </FlowStep.Next>
                </FlowStep>
              </Flowchart.StartNode>
              <x:Reference>__ReferenceID0</x:Reference>
              <x:Reference>__ReferenceID1</x:Reference>
              <x:Reference>__ReferenceID2</x:Reference>
            </Flowchart>
            <jgra:LockEntity DisplayName="LockSourceDatabase" EntityGuid="[SourceDatabaseInstanceGuid]" sap:VirtualizedContainerService.HintSize="317,22" JobGuid="[JobGuid]" UserGuid="[UserGuid]" />
            <jgra:LockEntity DisplayName="LockDestinationDatabase" EntityGuid="[DestinationDatabaseInstanceGuid]" sap:VirtualizedContainerService.HintSize="317,22" JobGuid="[JobGuid]" UserGuid="[UserGuid]" />
            <local:FindDatabaseInstanceFiles sap:VirtualizedContainerService.HintSize="317,22" JobGuid="[JobGuid]" SourceDatabaseInstanceFileGuids="[SourceDatabaseInstanceFileGuids]" SourceDatabaseInstanceGuid="[SourceDatabaseInstanceGuid]" UserGuid="[UserGuid]" />
            <local:DetachDatabase DatabaseInstanceGuid="[SourceDatabaseInstanceGuid]" DisplayName="DetachSourceDatabase" sap:VirtualizedContainerService.HintSize="317,22" JobGuid="[JobGuid]" UserGuid="[UserGuid]" />
            <ParallelForEach x:TypeArguments="s:Guid" DisplayName="ParallelForEach DiskVolume" sap:VirtualizedContainerService.HintSize="317,340" Values="[SourceDatabaseInstanceFileGuids.Keys]">
              <ActivityAction x:TypeArguments="s:Guid">
                <ActivityAction.Argument>
                  <DelegateInArgument x:TypeArguments="s:Guid" Name="diskVolumeGuid" />
                </ActivityAction.Argument>
                <ForEach x:TypeArguments="s:Guid" DisplayName="ForEach DatabaseInstanceFile" sap:VirtualizedContainerService.HintSize="287,234" Values="[SourceDatabaseInstanceFileGuids(diskVolumeGuid)]">
                  <ActivityAction x:TypeArguments="s:Guid">
                    <ActivityAction.Argument>
                      <DelegateInArgument x:TypeArguments="s:Guid" Name="sourceFileGuid" />
                    </ActivityAction.Argument>
                    <jga:Retry Finally="{x:Null}" sap:VirtualizedContainerService.HintSize="257,128" MaxRetries="3">
                      <local:MirrorDatabaseFile DestinationDatabaseInstanceGuid="[DestinationDatabaseInstanceGuid]" FileCopyDirection="[Jhu.Graywulf.Registry.FileCopyDirection.Push]" sap:VirtualizedContainerService.HintSize="200,22" JobGuid="[JobGuid]" SourceFileGuid="[sourceFileGuid]" UserGuid="[UserGuid]" />
                    </jga:Retry>
                  </ActivityAction>
                </ForEach>
              </ActivityAction>
            </ParallelForEach>
            <local:AttachDatabase DatabaseInstanceGuid="[SourceDatabaseInstanceGuid]" DisplayName="AttachSourceDatabase" sap:VirtualizedContainerService.HintSize="317,22" JobGuid="[JobGuid]" UserGuid="[UserGuid]" />
            <local:AttachDatabase DatabaseInstanceGuid="[DestinationDatabaseInstanceGuid]" DisplayName="AttachDestinationDatabase" sap:VirtualizedContainerService.HintSize="317,22" JobGuid="[JobGuid]" UserGuid="[UserGuid]" />
            <jgra:ReleaseEntity DisplayName="ReleaseSourceDatabase" EntityGuid="[SourceDatabaseInstanceGuid]" sap:VirtualizedContainerService.HintSize="317,22" JobGuid="[JobGuid]" UserGuid="[UserGuid]" />
            <jgra:ReleaseEntity DisplayName="ReleaseDestinationDatabase" EntityGuid="[DestinationDatabaseInstanceGuid]" sap:VirtualizedContainerService.HintSize="317,22" JobGuid="[JobGuid]" UserGuid="[UserGuid]" />
            <jga:EnqueueItem x:TypeArguments="s:Guid" DisplayName="EnqueueSourceDatabase" sap:VirtualizedContainerService.HintSize="317,22" InputQueue="[SourceDatabaseInstanceGuids]" Item="[SourceDatabaseInstanceGuid]" />
            <jga:EnqueueItem x:TypeArguments="s:Guid" DisplayName="EnqueueDestinationDatabase" sap:VirtualizedContainerService.HintSize="317,22" InputQueue="[SourceDatabaseInstanceGuids]" Item="[DestinationDatabaseInstanceGuid]" />
          </Sequence>
        </ActivityAction>
      </ParallelForEach>
  </Sequence>
</Activity>