mule的配置文件:
<?xml version="1.0" encoding="UTF-8"?> <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:http="http://www.mulesoft.org/schema/mule/http" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd"> <spring:bean id="doSpringWork" class="com.easyway.mule.spring.httpinvoker.remoting.DoSomeWork" /> <!-- Transform a byte[] from an Http request into a Spring RemoteInvocation instance. --> <custom-transformer name="springInputXform" class="org.mule.module.spring.remoting.ObjectToRemoteInvocationTransformer" /> <!-- Convert an Object to a Spring RemoteInvocationResult and then into a byte[] for return to the caller via Http. --> <custom-transformer name="springOutputXform" class="org.mule.module.spring.remoting.ObjectToRemoteInvocationResultTransformer" /> <model name="main"> <!-- SpringHttpInvokerComponent will receive a RemoteInvocation and execute the requested method on a POJO specified by "serviceClass". --> <service name="doSomeWorkViaSpring"> <!-- Listen on 8003 for Http requests. Use springInputXform to convert a byte[] from Http into a RemoteInvocation. Use springOutputXform to convert a Object from the Mule pipeline into a RemoteInvocationResult and then into a byte[]. --> <inbound> <inbound-endpoint address="http://localhost:8003/springService" exchange-pattern="request-response"> <transformer ref="springInputXform" /> <response> <transformer ref="springOutputXform" /> </response> </inbound-endpoint> </inbound> <pooled-component> <prototype-object class="org.mule.module.spring.remoting.SpringRemoteInvokerComponent"> <properties> <!-- Instead of setting the class, provide SpringHttpInvokerComponent with a Spring managed bean instead. (This doesn't work yet because I don't know how to teach SpringHttpInvokerComponent to find Spring beans.) --> <spring:entry key="serviceBean" value-ref="doSpringWork" /> <!-- Set the serviceInterface property of Spring's RemoteInvocationBasedExporter --> <spring:entry key="serviceInterface" value="com.easyway.mule.spring.httpinvoker.remoting.WorkInterface" /> <!-- Set other properties of Spring's RemoteInvocationBasedExporter i.e. registerTraceInterceptor and remoteInvocationExecutor --> </properties> </prototype-object> </pooled-component> </service> </model> </mule>
package com.easyway.mule.spring.httpinvoker.remoting; import org.mule.util.StringUtils; import java.io.Serializable; public class ComplexData implements Serializable { private static final long serialVersionUID = -886414019167115007L; private String someString = "Default String"; private Integer someInteger = new Integer(13); public ComplexData() { super(); } public ComplexData(String someString, Integer someInteger) { super(); setSomeString(someString); setSomeInteger(someInteger); } public String toString() { try { String currentString = StringUtils.defaultIfEmpty(someString, "NULL"); return "[ComplexData: [someString=" + currentString + "][someInteger=" + someInteger + "]]"; } catch (Exception e) { throw new RuntimeException(e); } } public Integer getSomeInteger() { return someInteger; } public void setSomeInteger(Integer someInteger) { this.someInteger = someInteger; } public String getSomeString() { return someString; } public void setSomeString(String someString) { this.someString = someString; } }
package com.easyway.mule.spring.httpinvoker.remoting; /** * A server-side service to receive and process ComplexData. */ public class DoSomeWork implements WorkInterface { public String executeByteArray(byte[] input) { return executeString(new String(input)); } public String executeString(String input) { return "You said " + input; } public ComplexData executeComplexity(ComplexData input) { input.setSomeString(input.getSomeString() + " Received"); input.setSomeInteger(new Integer(input.getSomeInteger().intValue() + 1)); return input; } }
package com.easyway.mule.spring.httpinvoker.remoting; public interface WorkInterface { String executeByteArray(byte[] input); String executeString(String input); ComplexData executeComplexity(ComplexData input); }
服务端测试:
package com.easyway.httpinvoker; import org.mule.api.MuleContext; import org.mule.api.context.MuleContextFactory; import org.mule.config.spring.SpringXmlConfigurationBuilder; import org.mule.context.DefaultMuleContextFactory; /** * * @author longgangbai * */ public class HttpInvokerServer { public static void main(String[] args) { try { // String configFile = "spring-remoting-mule-config-flow.xml"; // String configFile = "spring-remoting-mule-config-service.xml"; String configFile = "spring-remoting-mule-config.xml"; System.setProperty("mule.verbose.exceptions","true"); String[] configFileArr = new String[] {configFile }; MuleContextFactory muleContextFactory = new DefaultMuleContextFactory(); MuleContext muleContext = muleContextFactory .createMuleContext(new SpringXmlConfigurationBuilder(configFileArr)); muleContext.start(); } catch (Exception e) { e.printStackTrace(); } } }
客户端测试:
package com.easyway.httpinvoker; import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean; import com.easyway.mule.spring.httpinvoker.remoting.ComplexData; import com.easyway.mule.spring.httpinvoker.remoting.WorkInterface; /** * * @author longgangbai * */ public class HttpInvokerClient { private static final String SPRING_HTTP_ENDPOINT = "http://localhost:8003/springService"; public static void main(String[] args) { ComplexData cd = new ComplexData("Foo", new Integer(13)); HttpInvokerProxyFactoryBean invoker = new HttpInvokerProxyFactoryBean(); invoker.setServiceInterface(WorkInterface.class); invoker.setServiceUrl(SPRING_HTTP_ENDPOINT); invoker.afterPropertiesSet(); WorkInterface worker = (WorkInterface)invoker.getObject(); ComplexData data = worker.executeComplexity(cd); System.out.println(data.getSomeString()); System.out.println(data.getSomeInteger()); } }
相关推荐
- **RMI 和 HttpInvoker 认证**:支持远程方法调用的透明认证传播。 - **自动“记住我”认证**:允许用户在一段时间内无需重复认证。 - **匿名认证**:对于不关心用户身份的场景,自动假设一个特定的安全主体。 - **...
- **Mule ESB**: 一种企业服务总线,可以集成Spring Security来增强消息传递的安全性。 - **Grails**: 一种基于Groovy语言的Web应用框架,支持Spring Security作为安全模块。 - **Tapestry**: 一个用于构建高度交互...
- **Transparent Authentication Context Propagation for Remote Method Invocation (RMI) and HttpInvoker**:Spring远程调用协议的一种透明身份验证上下文传播方式。 - **Automatic "Remember-Me" Authentication...
内容概要:本文详细介绍了西门子S7-200SMART PLC与V20变频器通过Modbus RTU协议进行通信的具体方法和技术要点。首先阐述了硬件连接方式,强调了正确的接线和参数设置对于稳定通信的重要性。接着深入讲解了PLC程序的设计,包括Modbus主站初始化、启停控制、频率设定以及断电自恢复等功能模块的实现。此外还分享了一些实用的经验技巧,如避免通讯冲突、处理浮点数转换等问题。最后提到该方案已在实际生产环境中成功应用,表现出良好的稳定性和可靠性。 适合人群:从事自动化控制系统集成的技术人员,特别是熟悉西门子PLC和变频器产品的工程师。 使用场景及目标:适用于需要将旧型号PLC与变频器进行高效集成的企业,在不影响原有设备的基础上提升系统的智能化水平,减少人工干预,提高生产效率。 其他说明:文中提供了大量具体的编程实例和参数配置指南,有助于读者快速掌握相关技能并应用于实际工作中。同时提醒读者注意一些常见的错误及其解决方案,帮助规避潜在的风险。
内容概要:本文详细介绍了西门子PLC中用于电机控制的封装功能块,涵盖正转、反转、变频控制等多种功能。通过简化底层代码,提高编程效率和系统可靠性。文章展示了如何使用功能块实现正转、反转、变频控制、模拟量处理、故障处理等功能,并结合用户自定义数据类型(UDT)和多重背景技术,实现对大量电机的高效管理。此外,还提供了具体的代码示例,帮助读者更好地理解和应用这些功能块。 适合人群:从事工业自动化领域的工程师和技术人员,尤其是那些需要频繁处理电机控制任务的人群。 使用场景及目标:适用于需要简化电机控制编程、提高系统可靠性和可维护性的工业环境。主要目标是减少重复编码的工作量,提升开发效率,确保系统稳定运行。 其他说明:文中提供的代码示例和方法不仅有助于初学者快速入门,也为有经验的工程师提供了优化现有系统的思路。通过使用这些功能块,可以在短时间内完成复杂电机控制系统的搭建和调试。
全球腐败感知数据(2000-2023)——3000行 33个指标 关于数据集 该数据集包含3000行和33列,涵盖了2000年至2023年的腐败感知指数(CPI)数据和各种治理指标。它包括国家排名、分数和其他指标,如公共部门腐败、司法腐败、贿赂指数、商业道德、民主指数、法治、政府效率、经济指标和人类发展指数。 这些数据可用于: 腐败趋势分析 腐败对GDP、人类发展指数和治理的影响 跨国比较 数据可视化和机器学习模型 该数据集对研究人员、数据分析师、政策制定者和对研究全球腐败趋势非常有用。
街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用
内容概要:本文档详细介绍了将贝叶斯优化应用于FBCCA(滤波器组公共空间模式)参数调整的完整解决方案,包括代码实现和优化流程。首先,通过MNE库加载并预处理EEG数据,进行7-30Hz的预滤波处理,提取相关事件片段。接着,定义了FBCABayesianOptimizer类,该类包含创建动态滤波器组、获取模型参数以及定义优化目标函数的方法。其中,参数空间由离散和连续参数组成,涵盖了滤波器数量、CSP组件数、起始频率、带宽、交叠率等,并通过Optuna库进行多维搜索。优化过程中采用5折交叉验证机制,同时引入智能早停策略以提高效率。最后,提供了优化结果的可视化工具,如优化轨迹图、参数重要性图和滤波器组配置图,帮助用户更好地理解和分析优化过程。 适合人群:具有一定编程基础,尤其是对机器学习、脑电数据分析及贝叶斯优化感兴趣的科研人员和技术开发者。 使用场景及目标:①通过动态滤波器组生成算法,捕捉频段间的过渡特征;②利用混合参数空间设计,探索不同参数组合的效果;③借助高效交叉验证机制和智能早停策略,提高优化效率;④通过可视化工具,直观展示优化过程和结果。 阅读建议:此资源不仅展示了完整的代码实现,还深入探讨了FBCCA参数调整的理论基础和实际应用。建议读者在学习过程中结合理论知识与代码实践,逐步理解每个步骤的原理,并尝试调整参数以观察不同设置对优化效果的影响。同时,可根据自身硬件条件,考虑扩展建议中的GPU加速、分布式优化和在线学习等高级特性。
街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用
街道级行政区划shp数据,wgs84坐标系,直接使用。
街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用
街道级行政区划shp数据,wgs84坐标系,直接下载使用。
Matlab领域上传的视频是由对应的完整代码运行得来的,完整代码皆可运行,亲测可用,适合小白; 1、从视频里可见完整代码的内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2019b;若运行有误,根据提示修改;若不会,私信博主; 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可私信博主; 4.1 博客或资源的完整代码提供 4.2 期刊或参考文献复现 4.3 Matlab程序定制 4.4 科研合作
街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用
电子信息工程专业毕业论文模板_基于FPGA的CRC编码器设计.pdf
鄂尔多斯市-达拉特旗-街道行政区划_150621_Shp数据-wgs84坐标系.rar
内容概要:本文详细介绍了STM32与三菱PLC FX系列整合方案,涵盖多种功能模块的实现方法及其应用场景。首先,通过寄存器级别的低层操作展示了数码管驱动、模拟量采集、定时器PWM配置等功能的具体实现方式。其次,针对定位功能进行了深入探讨,包括12轴运动控制、4路200kHz高速脉冲输出以及CAN总线扩展等高级特性。此外,文中提供了三种不同层次的代码版本供开发者选择,分别是寄存器版本、库函数版本和即将发布的HAL库版本,满足不同程度用户的开发需求。最后,强调了该方案在工业控制领域的广泛应用前景,如包装机械、立体仓库等。 适合人群:具有一定嵌入式开发经验的研发人员,尤其是对STM32和三菱PLC有研究兴趣的技术爱好者。 使用场景及目标:适用于需要将STM32与三菱PLC进行深度整合的工程项目,旨在提高工业控制系统的灵活性和功能性。具体目标包括但不限于实现高效的梯形图上传下载、在线监控、多轴运动控制、模拟量采集及CAN总线通信等功能。 其他说明:文中不仅提供了详细的代码示例和技术细节,还分享了一些实用技巧,如寄存器操作注意事项、库函数的优势以及未来HAL库版本的发展方向。对于希望深入了解STM32与三菱PLC整合方案的读者而言,是一份不可多得的学习资料。
内容概要:本文详细介绍了西门子S7-200SMART PLC与V20变频器通过Modbus RTU进行通讯的具体实施方案,涵盖硬件接线、变频器参数设置、PLC程序编写以及触摸屏配置等方面的内容。重点解决了断电自恢复的问题,确保系统在断电重启后能够自动恢复正常运行。文中还提供了多个调试技巧和常见问题解决方案,如RS485接线注意事项、波特率设置、Modbus地址映射等。 适合人群:从事工业自动化领域的工程师和技术人员,尤其是熟悉PLC和变频器应用的专业人士。 使用场景及目标:适用于需要将PLC与变频器集成的应用场合,特别是在电力供应不稳定或存在突发断电风险的环境中。目标是提高系统的稳定性和可靠性,减少人工干预,提升生产效率。 其他说明:文中提到的实际案例表明,该方案已在多个工业现场成功应用并长期稳定运行,证明了其可行性和优越性。此外,作者还分享了一些个人经验教训,帮助读者避免常见的错误和陷阱。
内容概要:本文详细介绍了基于西门子200PLC的全自动不锈钢焊接系统的程序设计及其配套的维纶触摸屏程序。项目采用了模块化设计,分为多个功能块如故障处理(FB_FaultHandling)、复位(FB_Reset)、自动模式(FB_AutoMode)和手动模式(FB_ManualMode),每个功能块职责明确,便于维护和复用。此外,还包括详细的地址分配表、电路原理图以及触摸屏界面设计,确保了系统的通用性和可维护性。文中还特别强调了故障处理模块的堆栈设计、安全回路的双冗余设计以及焊接参数的自动化计算等功能,展示了工业控制领域的最佳实践。 适合人群:从事PLC编程、工业自动化控制、机械设备维护的技术人员和工程师。 使用场景及目标:适用于需要设计和实施全自动焊接系统的工程项目,旨在提高生产效率、减少故障停机时间、优化焊接质量。通过学习本文,读者可以掌握模块化编程技巧、故障处理方法以及人机交互界面设计的最佳实践。 其他说明:本文不仅提供了具体的代码实现和电路图,还分享了许多实际调试经验和优化建议,帮助读者更好地理解和应用这些技术和方法。
街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用