Package jfun.yan.factory

Examples of jfun.yan.factory.Factory


import jfun.yan.lifecycle.Procedure;


final class FactoryProcedure implements Procedure {
  public void invoke(Object self, Object[] args){
    final Factory f = (Factory)self;
    f.create();
  }
View Full Code Here


        // Register the service
        xFire.getServiceRegistry().register(xfireService);
       
        // If we're referencing a proxy via a Factory, which may be lazy,
        // set up our invoker using the factory.
        final Factory servant = getServant();
        if (servant != null) {
            xfireService.setInvoker(new FactoryInvoker(servant, scope));
        }

        if (schemas != null)
View Full Code Here

  private final Object xfire_name;
  private static final NutIntrospector introspector = new NutIntrospector();
  protected void decorateProcessor(NutsProcessor processor, ServletContext ctxt) throws Exception {
    super.decorateProcessor(processor, ctxt);
    final NutDescriptor desc = introspector.getNutDescriptor(ServiceNut.class);
    desc.setFactory(new Factory(){
      public Object create(){
        return new ServiceNut(Components.useKey(xfire_name));
      }
    });
    processor.registerNut("service", desc);
View Full Code Here

    interpreter.processFile("test/yan/test_spring.xml");
    final Container yan = interpreter.getContainer();
    final Greeter greeter = (Greeter)yan
      .getInstance("myController");
    greeter.greet();
    final Factory factory = (Factory)yan.getInstance("myfactory");
    factory.create();
    final Factory factory2 = (Factory)yan.getInstance("myfactory2");
    factory2.create();
    final FactoryBean fb = SpringAdapter.getFactoryBean(yan, "myController");
    assertNotNull(fb);
  }
View Full Code Here

  }
  private synchronized void addNuts(Container nuts, Map descs){
    for(Iterator it=descs.keySet().iterator();it.hasNext();){
      final Object key = it.next();
      final NutDescriptor desc = (NutDescriptor)descs.get(key);
      final Factory factory = nuts.getFactory(key);
      desc.setFactory(factory);
      registerNut(key.toString(), desc);
    }
  }
View Full Code Here

  private final Pool pool;
  Object super_create(final Dependency a) {
    return super.create(a);
  }
  public Object create(final Dependency a) {
    return pool.getInstance(new Factory(){
      public Object create(){
        return super_create(a);
      }
    });
  }
View Full Code Here

      return getFactory(key);
    }
    else return super.getFactory(key, cmap);
  }
  public synchronized Factory getFactory(Object key){
    Factory result = (Factory)key_factory_cache.get(key);
    if(result==null){
      result = super.getFactory(key);
      key_factory_cache.put(key, result);
    }
    return result;
View Full Code Here

  }
  public String toString(){
    return "proxy <" + getDelegateTarget() +">";
  }
  public Object create(final Dependency dep){
    return InstanceProxy.instance(cl, itfs, new Factory(){
      public Object create(){
        return getDelegateTarget().create(dep);
      }
    });
  }
View Full Code Here

TOP

Related Classes of jfun.yan.factory.Factory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.