Processor Chains and the Pipeline Manager

PipelineManager与处理器链
本文介绍了PipelineManager的概念及其配置方法,详细解析了如何创建处理器(Processor),并展示了Pipeline定义文件的结构。通过实例展示了不同处理器如何被组织进链中,并说明了如何根据返回值决定流程走向。

Processor Chains and the Pipeline Manager

Processor 就是一个执行一些功能和返回状态码的一个组件,状态码决定chain中下一个是哪一个processor被执行。

 

PipelineManager 可以使你动态的添加或删除processor.Pipeline要执行processor。需要调用runProcess().他首先会找请求的链,如果is enable,PipelineManager 调用runProcess(),如果isn't enable,就会抛出一个异常。

 

The following sections describe how to create a processor pipeline:

 

配置Pipeline Manager:

每一个processor chain 都是有pipeline manager 控制的,它位于/atg/commerce/

PipelineManager. The PipelineManager属性:

$class=atg.commerce.pipeline.CommercePipelineManager

# The location of the XML configuration file in the classpath.
# Default: /atg/commerce/CommercePipeline.xml
definitionFile=/atg/commerce/commercepipeline.xml


# The transaction manager that the PipelineManager will use to coordinate its
# transactions.
transactionManager=/atg/dynamo/transaction/TransactionManager

# The amount of time in milliseconds that a thread will wait to execute a pipeline.
# Default: 15000 msec
chainLockWaitTimeout=15000

#
# The schedule to reinitialize the PipelineManager.
#
scheduler=/atg/dynamo/service/Scheduler
schedule=every 6 hours in 6 hours

 definitionFile是定义processor chains的。

 

Creating Processors:

首先要实现atg.service.pipeline.PipelineProcessor interface。

 

public abstract interface PipelineProcessor
{
  public static final String CLASS_VERSION = "$Id: //product/DAS/version/10.2/Java/atg/service/pipeline/PipelineProcessor.java#2 $$Change: 768621 $";
  public static final int STOP_CHAIN_EXECUTION_AND_COMMIT = 0;
  public static final int STOP_CHAIN_EXECUTION = 0;
  public static final int STOP_CHAIN_EXECUTION_AND_ROLLBACK = -1;
  
  public abstract int runProcess(Object paramObject, PipelineResult paramPipelineResult)
    throws Exception;
  
  public abstract int[] getRetCodes();
}

 

public abstract class ProcProcessPaymentGroup extends GenericService
  implements PipelineProcessor
{
  public static String CLASS_VERSION = "$Id: //product/DCS/version/10.2/Java/atg/commerce/payment/processor/ProcProcessPaymentGroup.java#2 $$Change: 768796 $";
  public static final int SUCCESS = 1;

  protected void invokeProcessorAction(PaymentManagerAction pProcessorAction, PaymentManagerPipelineArgs pParams)
    throws CommerceException
  {
    PaymentStatus status = null;

    if (isLoggingDebug()) {
      logDebug("Obtained processorAction with: " + pProcessorAction);
    }
    if (pProcessorAction == PaymentManagerAction.AUTHORIZE)
      status = authorizePaymentGroup(pParams);
    else if (pProcessorAction == PaymentManagerAction.DEBIT)
      status = debitPaymentGroup(pParams);
    else if (pProcessorAction == PaymentManagerAction.CREDIT)
      status = creditPaymentGroup(pParams);
    else if (pProcessorAction == PaymentManagerAction.DECREASE_AUTH_AMT)
      status = decreaseAuthorizationForPaymentGroup(pParams);
    else {
      throw new CommerceException("Invalid processor action specified: " + pProcessorAction);
    }
    pParams.setPaymentStatus(status);
  }

  public PaymentStatus decreaseAuthorizationForPaymentGroup(PaymentManagerPipelineArgs pParams)
    throws CommerceException
  {
    return null;
  }

  public abstract PaymentStatus authorizePaymentGroup(PaymentManagerPipelineArgs paramPaymentManagerPipelineArgs)
    throws CommerceException;

  public abstract PaymentStatus debitPaymentGroup(PaymentManagerPipelineArgs paramPaymentManagerPipelineArgs)
    throws CommerceException;

  public abstract PaymentStatus creditPaymentGroup(PaymentManagerPipelineArgs paramPaymentManagerPipelineArgs)
    throws CommerceException;

  public int runProcess(Object pParam, PipelineResult pResult)
    throws Exception
  {
    PaymentManagerPipelineArgs params = (PaymentManagerPipelineArgs)pParam;
    PaymentManagerAction action = params.getAction();
    try {
      invokeProcessorAction(action, params);
    }
    catch (CommerceException e) {
      logError(e);
      pResult.addError("ProcProcessPaymentGroupFailed", e);
      return 0;
    }

    return 1;
  }

  public int[] getRetCodes()
  {
    int[] retCodes = { 1 };
    return retCodes;
  }
}

 Pipeline Definition Files:

PipelineManager:定义文件根节点

pipelinechain: 定义一个procesor chain

  • name:名字
  • transaction:processor默认使用的事物模式
  • headlink:在processor chain中的第一个processor被执行
  • classname:将被实例化和用于PipelineChain对象,默认是atg.service.pipeline.PipelineChain.而且一定是他的子类
  • resultclassname:用于pipleineResult对象,The default is atg.service.pipeline.PipelineResult. The value must implement PipelineResult.

pipelinelink:在 processor chain中定义processor.

  • name:processor的名字
  • transaction

processor:The name of the PipelineProcessor object.

  1. jndi :所引用processor类,这个对象是通过JNDI来解决的e

transition:根绝返回值决定下一个将要被执行的引用

  1. returnvalue:An integer string that is used to define the next pipeline element.
  2. 下一个将会被执行的pipelineprocessor,如果当前的返回值匹配return value
<?xml version="1.0"?>
<!DOCTYPE PipelineManager SYSTEM "PipelineManager.dtd">
<PipelineManager>
<pipelinechain name="AddToCart" transaction="TX_REQUIRED" headlink="proc1">
<pipelinelink name="proc1">
<processor class="atg.commerce.addA"/>
<transition returnvalue="1" link="proc2"/>
<transition returnvalue="2" link="proc3"/>
</pipelinelink>
<pipelinelink name="proc2" transaction="TX_REQUIRES_NEW">
<processor class="atg.commerce.addB"/>
<transition returnvalue="1" link="proc4"/>
<transition returnvalue="2" link="proc5"/>
</pipelinelink>
<pipelinelink name="proc3">
<processor class="atg.commerce.addE"/>
<transition returnvalue="1" link="proc6"/>
<transition returnvalue="2" link="proc7"/>
<transition returnvalue="3" link="proc2"/>
</pipelinelink>
<pipelinelink name="proc4">
<processor class="atg.commerce.addC"/>
</pipelinelink>
<pipelinelink name="proc5" transaction="TX_REQUIRES_NEW">
<processor class="atg.commerce.addD"/>
</pipelinelink>
<pipelinelink name="proc6" transaction="TX_NOT_SUPPORTED">
<processor class="atg.commerce.addF"/>
</pipelinelink>
<pipelinelink name="proc7" transaction="TX_SUPPORTS">
<processor jndi="/dynamo/atg/commerce/addG"/>
</pipelinelink>
</pipelinechain>
<pipelinechain name="RemoveFromCart" transaction="TX_REQUIRED"
headlink="proc99" classname="atg.service.pipeline.PipelineMonoChain">
<pipelinelink name="proc99">
<processor class="atg.commerce.removeA"/>
</pipelinelink>
</pipelinechain>
</PipelineManager>



 

基于数据驱动的 Koopman 算子的递归神经网络模型线性化,用于纳米定位系统的预测控制研究(Matlab代码实现)内容概要:本文围绕“基于数据驱动的Koopman算子的递归神经网络模型线性化”展开,旨在研究纳米定位系统的预测控制问题,并提供完整的Matlab代码实现。文章结合数据驱动方法与Koopman算子理论,利用递归神经网络(RNN)对非线性系统进行建模与线性化处理,从而提升纳米级定位系统的精度与动态响应性能。该方法通过提取系统隐含动态特征,构建近似线性模型,便于后续模型预测控制(MPC)的设计与优化,适用于高精度自动化控制场景。文中还展示了相关实验验证与仿真结果,证明了该方法的有效性和先进性。; 适合人群:具备一定控制理论基础和Matlab编程能力,从事精密控制、智能制造、自动化或相关领域研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①应用于纳米级精密定位系统(如原子力显微镜、半导体制造设备)中的高性能控制设计;②为非线性系统建模与线性化提供一种结合深度学习与现代控制理论的新思路;③帮助读者掌握Koopman算子、RNN建模与模型预测控制的综合应用。; 阅读建议:建议读者结合提供的Matlab代码逐段理解算法实现流程,重点关注数据预处理、RNN结构设计、Koopman观测矩阵构建及MPC控制器集成等关键环节,并可通过更换实际系统数据进行迁移验证,深化对方法泛化能力的理解。
在游戏开发或图形编程中,模拟绳索、链条或其他弯曲线条效果是一个常见的需求。**Curved Lines System - Ropes, Chains and more** 是一个 Unity 插件,专为实现此类效果而设计。该插件支持 2D 和 3D 环境中的动态绳索和链条模拟,适用于游戏开发中的物理互动场景,例如吊桥、缆绳、动态摆动机制等。 插件版本 **1.03** 提供了基本的 API 接口和可视化工具,开发者可以通过 Unity 编辑器直接创建和调整曲线路径,并将物理组件附加到曲线上以实现动态行为。其核心功能包括: - **基于样条的曲线生成**:使用贝塞尔曲线或 Catmull-Rom 样条来定义绳索或链条的路径。 - **物理集成**:自动为曲线生成刚体和关节组件,使其能够与 Unity 的物理引擎交互。 - **可视化编辑**:在 Unity 编辑器中实时调整曲线控制点,并预览物理效果。 - **性能优化**:适用于移动端和桌面端,具备良好的性能表现[^1]。 插件的使用通常包括以下几个步骤: 1. **导入插件**:将插件包导入 Unity 项目中。 2. **创建曲线对象**:通过编辑器工具创建 Curved Line 对象,并调整控制点。 3. **添加物理组件**:通过插件提供的选项自动为曲线添加 Rigidbody 和 Hinge Joint 或 Fixed Joint。 4. **脚本控制**:使用插件提供的 API 实时控制曲线的形态或物理状态。 以下是一个简单的脚本示例,用于动态更新曲线控制点: ```csharp using UnityEngine; using CurvedLines; public class UpdateCurve : MonoBehaviour { public CurvedLineRenderer curvedLine; public Transform[] controlPoints; void Update() { // 更新曲线的控制点 curvedLine.UpdatePoints(GetBezierPoints()); } Vector3[] GetBezierPoints() { // 实现贝塞尔曲线计算 // 返回计算后的点数组 return new Vector3[] { /* 计算结果 */ }; } } ``` 关于插件的 **文档和使用指南**,官方通常提供 PDF 格式的用户手册以及 Unity 内置的示例场景。用户可以通过插件的 **Asset Store 页面** 或 **开发者支持论坛** 获取最新版本的文档。插件的 **下载链接** 通常位于 Unity Asset Store 或开发者提供的独立下载页面上。 若需获取 **Curved Lines System - Ropes, Chains and more 1.03 的下载包或文档**,建议访问 Unity Asset Store 中的插件页面或联系插件作者以获得官方支持材料。 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值