⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 groovyrefreshablebeanbuilder.java

📁 提供ESB 应用mule源代码 提供ESB 应用mule源代码
💻 JAVA
字号:
/* * $Id: GroovyRefreshableBeanBuilder.java 11197 2008-03-06 04:38:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */package org.mule.module.scripting.component;import org.mule.api.DefaultMuleException;import org.mule.api.MuleEventContext;import org.mule.api.lifecycle.Callable;import org.mule.config.i18n.CoreMessages;import org.mule.util.StringUtils;import groovy.lang.GroovyObject;import groovy.lang.MetaMethod;public class GroovyRefreshableBeanBuilder implements Callable{    private volatile Object refreshableBean;    private String methodName;    private static final String ON_CALL = "onCall";    private static final Class[] UMOEVENTCONTEXT = new Class[]{MuleEventContext.class};        public GroovyRefreshableBeanBuilder()    {        super();    }    public Object onCall(MuleEventContext eventContext) throws Exception    {        if (refreshableBean instanceof GroovyObject)        {            GroovyObject script = (GroovyObject)refreshableBean;            MetaMethod onCall = script.getMetaClass().pickMethod("onCall", UMOEVENTCONTEXT);            if (onCall != null)            {                return script.invokeMethod(ON_CALL, eventContext);            }            else            {                if (StringUtils.isEmpty(methodName))                {                    throw new DefaultMuleException(CoreMessages.propertiesNotSet("methodName"));                }                                return script.invokeMethod(methodName, eventContext.transformMessage());            }                    }                throw new Exception(new DefaultMuleException("script engine not supported"));    }    public Object getRefreshableBean()    {        return refreshableBean;    }    public void setRefreshableBean(Object refreshableBean)    {        this.refreshableBean = refreshableBean;    }        public String getMethodName()    {        return methodName;    }    public void setMethodName(String methodName)    {        this.methodName = methodName;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -