Skip to content

Commit

Permalink
Merge pull request #3 from OpenTouryoProject/develop
Browse files Browse the repository at this point in the history
Release work ( ~ October 1, 2018)
  • Loading branch information
yusukemaegawa authored Sep 26, 2018
2 parents ddc1238 + 2b679ed commit 8753a66
Show file tree
Hide file tree
Showing 52 changed files with 3,442 additions and 2,140 deletions.
15 changes: 15 additions & 0 deletions root/files/resource/AsyncProcessingService/Xml/SPDefinition.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE SPD[
<!ELEMENT SPD (SharedProp*)>
<!ELEMENT SharedProp EMPTY>
<!ATTLIST SharedProp
key ID #REQUIRED
value CDATA #REQUIRED>
]>
<!-- key(id)の先頭には、数字を使用できない。 -->
<SPD>
<SharedProp key="ConnectionString1" value="てすと1"/>
<SharedProp key="ConnectionString2" value="てすと2"/>
<SharedProp key="HostName1" value="てすと3"/>
<SharedProp key="HostName2" value="てすと4"/>
</SPD>
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,10 @@
<!ATTLIST Url id ID #REQUIRED value CDATA #REQUIRED>
<!ATTLIST Prop id ID #REQUIRED value CDATA #REQUIRED>
<!ATTLIST Transmission id ID #REQUIRED protocol (1 | 2) #REQUIRED
url CDATA #IMPLIED url_ref IDREF #IMPLIED timeout CDATA #IMPLIED prop_ref IDREF #IMPLIED>
url CDATA #IMPLIED url_ref IDREF #IMPLIED timeout CDATA #IMPLIED prop_ref IDREF #IMPLIED>
]>
<!-- idの先頭には、数字を使用できない。 -->
<!-- protocol:1=InProcess、2=WebService -->
<TMD>
<!-- マスタ データ -->

<!-- 接続URL(asmx単位に定義する) -->
<Url id="url_a" value="http://localhost/ASPNETWebService/ServiceForFx.asmx"/>
<Url id="url_b" value="http://localhost/ASPNETWebService/WCFHTTPSvcForFx.svc"/>
<Url id="url_c" value="net.tcp://localhost:7777/WCFService/WCFTCPSvcForFx/"/>

<!-- 接続オプション(必要に応じて) -->
<Prop id="prop_a" value="aaa=AAA;bbb=BBB;ccc=CCC;"/>

<!-- 接続先 データ -->

<!-- インプロセス -->
<Transmission id="AsyncSvc_sample" protocol="1"/>
<Transmission id="AAA" protocol="1"/>
</TMD>
1 change: 1 addition & 0 deletions root/programs/CS/6_CopyToService.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xcopy /E /Y "Samples\AsyncSvc_sample\AsyncSvc_sample\bin\Debug" "Frameworks\Infrastructure\AsyncProcessingService\bin\Debug\"
1 change: 1 addition & 0 deletions root/programs/CS/7_SubmitTask.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
call "Samples\AsyncSvc_sample\TestAsyncSvc_Sample\bin\Debug\TestAsyncSvc_Sample.exe"

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Compile Include="AsyncProcessingService.cs" />
<Compile Include="AsyncProcessingService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServiceInstaller.cs">
<SubType>Component</SubType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<?xml version="1.0"?>
<configuration>
<appSettings>
<!-- 共通部品の使用するパラメータ - start -->
<!-- 非同期処理サービスの使用するパラメータ - start -->
<add key="FxMaxThreadCount" value="10"/>
<add key="FxNumberOfSeconds" value="1"/>
<add key="FxMaxNumberOfRetries" value="10"/>
<add key="FxMaxNumberOfHours" value="24"/>

<!-- シミュレーション実行 - start -->
<add key="FxSleepUserProcess" value="5"/>
<add key="FxAbortPercentage" value="3"/>
<add key="FxStopPercentage" value="10"/>

<add key="FxMaxProgressRate" value="30"/>
<add key="FxStopPercentage" value="3"/>
<add key="FxAbortPercentage" value="1"/>

<!-- インプロセス呼出用 -->
<add key="FxXMLTMProtocolDefinition" value="C:\root\files\resource\AsyncProcessingService\Xml\TMProtocolDefinition.xml"/>
<add key="FxXMLTMInProcessDefinition" value="C:\root\files\resource\AsyncProcessingService\Xml\TMInProcessDefinition.xml"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
//**********************************************************************************
//* Copyright (C) 2007,2016 Hitachi Solutions,Ltd.
//**********************************************************************************

#region Apache License
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion

//**********************************************************************************
//* クラス名 :LayerB
//* クラス日本語名 :LayerB
//*
//* 日時 更新者 内容
//* ---------- ---------------- -------------------------------------------------
//* 11/28/2014 Supragyan Created LayerB class for AsyncProcessing Service
//* 11/28/2014 Supragyan Created Insert,Update,Select method for AsyncProcessing Service
//* 04/15/2015 Sandeep Did code modification of insert, update and select for AsyncProcessing Service
//* 06/09/2015 Sandeep Implemented code to update stop command to all the running asynchronous task
//* Modified code to reset Exception information, before starting asynchronous task
//* 06/26/2015 Sandeep Implemented code to get commandID in the SelectTask method,
//* to resolve unstable "Register" state, when you invoke [Abort] to AsyncTask, at this "Register" state
//* 06/01/2016 Sandeep Implemented method to test the connection of specified database
//* 2018/08/24 西野 大介 クラス名称の変更( ---> Aps)
//**********************************************************************************

using System;
using System.Data;

using Touryo.Infrastructure.Business.Business;

namespace Touryo.Infrastructure.Business.AsyncProcessingService
{
/// <summary>
/// LayerB class for AsyncProcessing Service
/// </summary>
public class ApsLayerB : MyFcBaseLogic
{
#region Insert

/// <summary>
/// Inserts Async Parameter values to Database through LayerD
/// </summary>
/// <param name="parameterValue"></param>
public void UOC_InsertTask(ApsParameterValue parameterValue)
{
// 戻り値クラスを生成して、事前に戻り値に設定しておく。
ApsReturnValue returnValue = new ApsReturnValue();
this.ReturnValue = returnValue;

ApsLayerD layerD = new ApsLayerD(this.GetDam());
layerD.InsertTask(parameterValue, returnValue);
}

#endregion

#region Update

#region UpdateTaskStart

/// <summary>
/// Updates information in the database that the asynchronous task is started
/// </summary>
/// <param name="parameterValue">Asynchronous Parameter Values</param>
private void UOC_UpdateTaskStart(ApsParameterValue parameterValue)
{
ApsReturnValue returnValue = new ApsReturnValue();
this.ReturnValue = returnValue;

ApsLayerD layerD = new ApsLayerD(this.GetDam());
layerD.UpdateTaskStart(parameterValue, returnValue);
}

#endregion

#region UpdateTaskRetry

/// <summary>
/// Updates information in the database that the asynchronous task is failed and can be retried later
/// </summary>
/// <param name="parameterValue">Asynchronous Parameter Values</param>
private void UOC_UpdateTaskRetry(ApsParameterValue parameterValue)
{
ApsReturnValue returnValue = new ApsReturnValue();
this.ReturnValue = returnValue;

ApsLayerD layerD = new ApsLayerD(this.GetDam());
layerD.UpdateTaskRetry(parameterValue, returnValue);
}

#endregion

#region UpdateTaskFail

/// <summary>
/// Updates information in the database that the asynchronous task is failed and abort this task [status=Abort]
/// </summary>
/// <param name="parameterValue">Asynchronous Parameter Values</param>
private void UOC_UpdateTaskFail(ApsParameterValue parameterValue)
{
ApsReturnValue returnValue = new ApsReturnValue();
this.ReturnValue = returnValue;

ApsLayerD layerD = new ApsLayerD(this.GetDam());
layerD.UpdateTaskFail(parameterValue, returnValue);
}

#endregion

#region UpdateTaskSuccess

/// <summary>
/// Updates information in the database that the asynchronous task is completed
/// </summary>
/// <param name="parameterValue">Asynchronous Parameter Values</param>
private void UOC_UpdateTaskSuccess(ApsParameterValue parameterValue)
{
ApsReturnValue returnValue = new ApsReturnValue();
this.ReturnValue = returnValue;

ApsLayerD layerD = new ApsLayerD(this.GetDam());
layerD.UpdateTaskSuccess(parameterValue, returnValue);
}

#endregion

#region UpdateTaskProgress

/// <summary>
/// Updates progress rate of the asynchronous task in the database.
/// </summary>
/// <param name="parameterValue">Asynchronous Parameter Values</param>
private void UOC_UpdateTaskProgress(ApsParameterValue parameterValue)
{
ApsReturnValue returnValue = new ApsReturnValue();
this.ReturnValue = returnValue;

ApsLayerD layerD = new ApsLayerD(this.GetDam());
layerD.UpdateTaskProgress(parameterValue, returnValue);
}

#endregion

#region UpdateTaskCommand

/// <summary>
/// Updates command value information of a selected asynchronous task
/// </summary>
/// <param name="parameterValue">Asynchronous Parameter Values</param>
private void UOC_UpdateTaskCommand(ApsParameterValue parameterValue)
{
ApsReturnValue returnValue = new ApsReturnValue();
this.ReturnValue = returnValue;

ApsLayerD layerD = new ApsLayerD(this.GetDam());
layerD.UpdateTaskCommand(parameterValue, returnValue);
}

#endregion

#region StopAllTask

/// <summary>
/// Set stop command for all running asynchronous task
/// </summary>
/// <param name="parameterValue">Asynchronous Parameter Values</param>
private void UOC_StopAllTask(ApsParameterValue parameterValue)
{
ApsReturnValue returnValue = new ApsReturnValue();
this.ReturnValue = returnValue;

ApsLayerD layerD = new ApsLayerD(this.GetDam());
layerD.StopAllTask(parameterValue, returnValue);
}

#endregion

#endregion

#region Select

#region SelectCommand

/// <summary>
/// Selects user command from Database through LayerD
/// </summary>
/// <param name="parameterValue"></param>
private void UOC_SelectCommand(ApsParameterValue parameterValue)
{
ApsReturnValue returnValue = new ApsReturnValue();
this.ReturnValue = returnValue;

ApsLayerD layerD = new ApsLayerD(this.GetDam());
layerD.SelectCommand(parameterValue, returnValue);
}

#endregion

#region SelectTask

/// <summary>
/// Selects Asynchronous task from LayerD
/// </summary>
/// <param name="parameterValue">Async Parameter Value</param>
private void UOC_SelectTask(ApsParameterValue parameterValue)
{
ApsReturnValue returnValue = new ApsReturnValue();
this.ReturnValue = returnValue;

ApsLayerD layerD = new ApsLayerD(this.GetDam());
layerD.SelectTask(parameterValue, returnValue);

DataTable dt = (DataTable)returnValue.Obj;
returnValue.Obj = null;

if (dt != null)
{
if (dt.Rows.Count != 0)
{
returnValue.TaskId = Convert.ToInt32(dt.Rows[0]["Id"]);
returnValue.UserId = dt.Rows[0]["UserId"].ToString();
returnValue.ProcessName = dt.Rows[0]["ProcessName"].ToString();
returnValue.Data = dt.Rows[0]["Data"].ToString();
returnValue.NumberOfRetries = Convert.ToInt32(dt.Rows[0]["NumberOfRetries"]);
returnValue.ReservedArea = dt.Rows[0]["ReservedArea"].ToString();
returnValue.CommandId = Convert.ToInt32(dt.Rows[0]["CommandId"]);
}
}
}

#endregion

#endregion

#region TestConnection

/// <summary>
/// Tests the connection with the specified database
/// </summary>
/// <param name="parameterValue">Async Parameter Value</param>
private void UOC_TestConnection(ApsParameterValue parameterValue)
{
ApsLayerD layerD = new ApsLayerD(this.GetDam());
}

#endregion
}
}
Loading

0 comments on commit 8753a66

Please sign in to comment.