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

📄 factoryinvoker.java

📁 Xfire文件 用于开发web service 的一个开源工具 很好用的
💻 JAVA
字号:
package org.codehaus.xfire.service.invoker;

import org.codehaus.xfire.MessageContext;
import org.codehaus.xfire.fault.XFireFault;
import org.codehaus.xfire.util.factory.Factory;


/**
 * This invoker implementation calls a Factory to create the service object
 * and then applies a scope policy for caching.
 * @author Ben Yu
 * Feb 2, 2006 12:55:59 PM
 */
public class FactoryInvoker extends AbstractInvoker {
  private final Factory factory;
  private final ScopePolicy scope;
  /**
   * Create a FactoryInvoker object.
   * @param factory the factory used to create service object.
   * @param scope the scope policy. Null for default.
   */
  public FactoryInvoker(Factory factory, ScopePolicy scope) {
    this.factory = factory;
    this.scope = scope==null?new ApplicationScopePolicy():scope;
  }

  public Object getServiceObject(MessageContext context)
  throws XFireFault{
    try{
      return getScopedFactory(context).create();
    }
    catch(XFireFault e){
      throw e;
    }
    catch(Throwable e){
      throw new XFireFault(e);
    }
  }
  private Factory getScopedFactory(MessageContext context){
    return scope.applyScope(factory, context);
  }
}

⌨️ 快捷键说明

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