Package juzu.impl.plugin.controller.descriptor

Examples of juzu.impl.plugin.controller.descriptor.ControllersDescriptor


    //
    return lifeCycle;
  }

  private Dispatch createDispatch(ControllerHandler<?> handler, DispatchBridge spi) {
    ControllersDescriptor desc = controllerPlugin.getDescriptor();
    Dispatch dispatch;
    if (handler.getPhase() == Phase.ACTION) {
      dispatch = new Phase.Action.Dispatch(spi);
    } else if (handler.getPhase() == Phase.VIEW) {
      dispatch = new Phase.View.Dispatch(spi);
      dispatch.escapeXML(desc.getEscapeXML());
    } else if (handler.getPhase() == Phase.RESOURCE) {
      dispatch = new Phase.Resource.Dispatch(spi);
      dispatch.escapeXML(desc.getEscapeXML());
    } else {
      throw new AssertionError();
    }
    dispatch.escapeXML(desc.getEscapeXML());
    return dispatch;
  }
View Full Code Here


  public ServiceDescriptor init(ServiceContext context) throws Exception {
    valueTypes.addAll(ValueType.DEFAULT);
    for (ValueType<?> valueType : Tools.loadService(ValueType.class, context.getClassLoader())) {
      valueTypes.add(valueType);
    }
    return descriptor = new ControllersDescriptor(context.getClassLoader(), context.getConfig());
  }
View Full Code Here

    //
    aClass = compiler.assertClass("plugin.controller.method.resource.A");
    compiler.assertClass("plugin.controller.method.resource.A_");
    Class<?> appClass = compiler.assertClass("plugin.controller.method.resource.Application");
    descriptor = ApplicationDescriptor.create(appClass);
    controllerDescriptor = new ControllersDescriptor(descriptor);
  }
View Full Code Here

    compiler.assertClass("plugin.controller.method.render.A_");

    //
    Class<?> appClass = compiler.assertClass("plugin.controller.method.render.Application");
    descriptor = ApplicationDescriptor.create(appClass);
    controllerDescriptor = new ControllersDescriptor(descriptor);
  }
View Full Code Here

    compiler.assertClass("plugin.controller.method.action.A_");

    //
    Class<?> appClass = compiler.assertClass("plugin.controller.method.action.Application");
    descriptor = ApplicationDescriptor.create(appClass);
    controllerDescriptor = new ControllersDescriptor(descriptor);
  }
View Full Code Here

    Class<?> appClass = compiler.assertClass("plugin.application.default_controller.Application");
    Class<?> aClass = compiler.assertClass("plugin.application.default_controller.A");

    //
    ApplicationDescriptor desc = ApplicationDescriptor.create(appClass);
    ControllersDescriptor controller = new ControllersDescriptor(desc);
    assertSame(aClass, controller.getDefaultController());
  }
View Full Code Here

    Class<?> appClass = compiler.assertClass("plugin.application.method.id.Application");
    Class<?> aClass = compiler.assertClass("plugin.application.method.id.A");

    //
    ApplicationDescriptor desc = ApplicationDescriptor.create(appClass);
    ControllersDescriptor controllerDesc = new ControllersDescriptor(desc);
    ControllerHandler a = controllerDesc.getHandler(aClass, "a");
    ControllerHandler b = controllerDesc.getHandler(aClass, "b");
    ControllerHandler c = controllerDesc.getHandler(aClass, "c");

    //
    assertEquals("foo", a.getId());
    assertEquals("bar", b.getId());
    assertEquals("juu", c.getId());

    //
    assertSame(a, controllerDesc.getMethodById("foo"));
    assertSame(b, controllerDesc.getMethodById("bar"));
    assertSame(c, controllerDesc.getMethodById("juu"));
  }
View Full Code Here

    //
    Class<?> app1Class = compiler.assertClass("plugin.application.multiple.app1.Application");
    Class<?> a1Class = compiler.assertClass("plugin.application.multiple.app1.A");
    ApplicationDescriptor desc1 = ApplicationDescriptor.create(app1Class);
    ControllersDescriptor controllerDesc1 = new ControllersDescriptor(desc1);
    assertSame(a1Class, controllerDesc1.getControllers().get(0).getType());

    //
    Class<?> app2Class = compiler.assertClass("plugin.application.multiple.app2.Application");
    Class<?> a2Class = compiler.assertClass("plugin.application.multiple.app2.A");
    ApplicationDescriptor desc2 = ApplicationDescriptor.create(app2Class);
    ControllersDescriptor controllerDesc2 = new ControllersDescriptor(desc2);
    assertSame(a2Class, controllerDesc2.getControllers().get(0).getType());
  }
View Full Code Here

    compiler.assertCompile();
    Class<?> appClass = compiler.assertClass("plugin.controller.resolver.default_method.Application");

    //
    ApplicationDescriptor desc = ApplicationDescriptor.create(appClass);
    ControllersDescriptor controllerDesc = new ControllersDescriptor(desc);
    ControllerResolver<ControllerHandler> resolver = controllerDesc.getResolver();
    ControllerHandler handler = resolver.resolve(Phase.VIEW, Collections.<String>emptySet());
    assertEquals("index", handler.getName());
  }
View Full Code Here

    compiler.assertCompile();
    Class<?> appClass = compiler.assertClass("plugin.controller.resolver.ambiguous_method.Application");

    //
    ApplicationDescriptor desc = ApplicationDescriptor.create(appClass);
    ControllersDescriptor controllerDesc = new ControllersDescriptor(desc);
    ControllerResolver<ControllerHandler> resolver = controllerDesc.getResolver();
    try {
      resolver.resolve(Phase.VIEW, Collections.<String>emptySet());
      fail();
    }
    catch (AmbiguousResolutionException e) {
View Full Code Here

TOP

Related Classes of juzu.impl.plugin.controller.descriptor.ControllersDescriptor

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.