Package jfun.yan.xml

Examples of jfun.yan.xml.NutsProcessor$CustomWiringModes


import junit.framework.TestCase;

public class InvocationOrderTestCase extends TestCase {
  public void test1()
  throws Exception{
    final NutsProcessor proc = new NutsProcessor();
    proc.processResource("tests/jfun/finecontrol/config.xml");
    final Container yan = proc.getContainer();
    yan.getInstance("a");
  }
View Full Code Here


   */
  public static void setSpringAware(String module_name,
      NutsProcessor processor,
      ClassLoader loader, String nuts_resource,
      String appcontext_resource){
    final NutsProcessor spring =
      processor.createMetaProcessor(loader);
    final Container yan = processor.getContainer();
    /*
    final ReloadableResourceBundleMessageSource msgsrc = new ReloadableResourceBundleMessageSource();
    msgsrc.setBasename("org/springframework/context/support/messages");
    final ApplicationEventPublisher aep = new ApplicationEventPublisher(){
     
    }*/
    final Container base = new ManualContainer();
    base.registerValue("modulename", module_name);
    base.registerValue("timestamp", new Long(System.currentTimeMillis()));
    base.registerValue("classloader", loader);
    base.registerValue("container", yan);
    final NutsProcessor cinterpreter = new NutsProcessor();
    //cinterpreter.setParameterWiring(Modes.params_bytype);
    try{
      cinterpreter.processResource(appcontext_resource);
    }
    catch(IOException e){
      throw new IllegalStateException("cannot startup spring integration.");
    }
   
    final Container context = cinterpreter.getContainer().inherit(base);
    final Container2ApplicationContext ctxt = (Container2ApplicationContext)
    context.getInstance("appcontext");
   
    final Container nuts = spring.getContainer();
    final DefaultLifecycleManager manager = processor.getLifecycleManager();
View Full Code Here

  private DefaultLifecycleManager manager;
  private Container yan;
  private NutsProcessor interpreter;
  protected void setUp() throws Exception {
    super.setUp();
    interpreter = new NutsProcessor();
    interpreter.registerService("echo_msg", "there ya go:");
    yan = interpreter.getContainer();
    manager = interpreter.getLifecycleManager();
  }
View Full Code Here

    final Listener l = new Listener(){
      public void onInstance(Object obj){
        cache.add(obj);
      }
    };
    final NutsProcessor meta = interpreter.createMetaInterpreter();
    meta.getContainer().registerValue(l);
    meta.processResource("tests/jfun/yan/xml/nuts/listeners.xml");
    interpreter.loadNutsFromContainer(meta.getContainer());
    interpreter.processFile("test/yan/test_pluggable_declarativeness.xml");
    final List instances = yan.getInstances();
    assertEquals(1, cache.size());
    assertSame(cache.get(0), instances.get(0));
    assertSame(cache.get(0), instances.get(2));
View Full Code Here

    custom_naming_service.put("tests/jfun/models/BankAccount/balance", new Integer(1000));
    custom_naming_service.put("tests/jfun/models/BankAccount/id", "auto lookup");
    final PropertyBinder lookup = new NamingServiceWiring(custom_naming_service);
    final PropertyBinder autolookup = new MapNamingServiceWiring("namingservice");
   
    processor = new NutsProcessor();
    processor.registerAutoWiring("lookup", lookup);
    processor.registerAutoWiring("autolookup", autolookup);
    processor.registerService("echo_msg", "there ya go:");
    yan = processor.getContainer();
    manager = processor.getLifecycleManager();
View Full Code Here

      fail("Greeter expected, "+r.getClass().getName()+" encountered");
    }
  }*/
  public void test2()
  throws IOException{
    final NutsProcessor interpreter = new NutsProcessor();
    SpringNuts.setSpringAware("test2", interpreter);
    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();
View Full Code Here

    }


    protected Container createContainer()
    throws IOException{
      NutsProcessor processor = new NutsProcessor(
          ClassLoaderUtils.guessClassLoader(getClass().getClassLoader()));
      processor.processResource("jfun/yan/xfire/xfireXmlBeans.xml");
      processor.processResource("tests/jfun/yan/xfire/echo.xml");
      processor.preInstantiate();
      return processor.getContainer();
    }
View Full Code Here

  private static final boolean spring_involved = true;
  private static final long LOOP = 200000;
  private Container yan = null;
  protected void setUp() throws Exception {
    super.setUp();
    final NutsProcessor processor = new NutsProcessor(getClass().getClassLoader());
    if(spring_involved)
      SpringNuts.setSpringAware("spring integration", processor);
    processor.processResource("tests/jfun/yan/benchmark/yan_component_config.xml");
    this.yan = processor.getContainer();
    Thread.sleep(100);
    System.gc();
    Thread.sleep(100);
    System.gc();
    Thread.sleep(100);
View Full Code Here

    if(in == null){
      ctxt.log("yan configuration file "+config_file+" not found.");
      return null;
    }
    try{
      final NutsProcessor proc = getNutsProcessor(cloader, rloader, ctxt);
      proc.process(rloader.getResource(config_file), in);
      registerServletContext(proc.getContainer(), ctxt);
      return proc;
    }
    finally{
      in.close();
    }
View Full Code Here

   * @return the result NutsProcessor object.
   * @throws Exception any error.
   */
  protected NutsProcessor getNutsProcessor(ClassLoader cloader, ResourceLoader rloader,
      ServletContext ctxt)throws Exception{
    final NutsProcessor proc = new NutsProcessor(cloader, rloader);
    decorateProcessor(proc, ctxt);
    return proc;
  }
View Full Code Here

TOP

Related Classes of jfun.yan.xml.NutsProcessor$CustomWiringModes

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.