Examples of ContextFactory


Examples of org.apache.webbeans.context.ContextFactory

    public void setInactive(AbstractContext context) {
        context.setActive(false);
    }

    public AbstractContext getDependentContext() {
        ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
        return (AbstractContext) contextFactory.getStandardContext(ContextTypes.DEPENDENT);
    }
View Full Code Here

Examples of org.apache.webbeans.context.ContextFactory

* @version $Rev$ $Date$
*/
public class ContextsImpl implements org.jboss.jsr299.tck.spi.Contexts<AbstractContext> {

    public AbstractContext getRequestContext() {
        ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
        RequestContext ctx = (RequestContext) contextFactory.getStandardContext(RequestScoped.class);

        if (ctx == null) {
            contextFactory.initRequestContext(null);
        }

        return (AbstractContext) contextFactory.getStandardContext(ContextTypes.REQUEST);
    }
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory

    private void dropRootScope() {

        // ensure the debugger is closed if the root scope will
        // be replaced to ensure no references to the old scope
        // and context remain
        ContextFactory contextFactory = ContextFactory.getGlobal();
        if (contextFactory instanceof SlingContextFactory) {
            ((SlingContextFactory) contextFactory).exitDebugger();
        }

        // drop the scope
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory

        setExtensions(ECMA_SCRIPT_EXTENSION, ESP_SCRIPT_EXTENSION);
        setMimeTypes("text/javascript", "application/ecmascript",
            "application/javascript");
        setNames("javascript", ECMA_SCRIPT_EXTENSION, ESP_SCRIPT_EXTENSION);

        final ContextFactory contextFactory = ContextFactory.getGlobal();
        if (contextFactory instanceof SlingContextFactory) {
            ((SlingContextFactory) contextFactory).setDebugging(debugging);
        }
        // set the dynamic class loader as the application class loader
        final DynamicClassLoaderManager dclm = this.dynamicClassLoaderManager;
        if ( dclm != null ) {
            contextFactory.initApplicationClassLoader(dynamicClassLoaderManager.getDynamicClassLoader());
        }
       
        log.info("Activated with optimization level {}", optimizationLevel);
    }
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory

        super(classpathReference);
    }

    public void initializeRhino() {

        rhinoContextFactory = new ContextFactory();
        if (System.getProperty("cxf.jsdebug") != null && !rhinoDebuggerUp) {
            try {
                Class<?> debuggerMain =
                            ClassLoaderUtils.loadClass("org.mozilla.javascript.tools.debugger.Main",
                                                                   getClass());
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory

        assertTrue("success".equals(result));
        System.out.println("passed");
    }
   
    public void runJsTests(File[] tests) throws IOException {
        ContextFactory factory = ContextFactory.getGlobal();
        Context cx = factory.enterContext();
        try {
            cx.setOptimizationLevel(this.optimizationLevel);
            Scriptable shared = cx.initStandardObjects();
            for (File f : tests) {
                int length = (int) f.length(); // don't worry about very long
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory

    }

    LegacyDataRowWrapper wrapper = null;
    try
    {
      final ContextFactory contextFactory = new ContextFactory();
      final Context context = contextFactory.enterContext();
      final Scriptable scope = context.initStandardObjects();
      wrapper = initializeScope(scope);

      final Object o = context.evaluateString(scope, expression, getName(), 1, null);
      if (o instanceof NativeJavaObject)
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory

   *
   * TODO: make the custom classloader work (at not loading all the Java classes).
   */
  @BeforeClass
  public static void messWithClassLoader() {
    ContextFactory.initGlobal(new ContextFactory() {
      @Override
      protected Context makeContext() {
        Context cx = super.makeContext();
        cx.setWrapFactory(new WrapFactory() {
          @Override
          public Object wrap(Context cx, Scriptable scope, Object obj, Class staticType) {
            return super.wrap(cx, scope, obj, staticType);
          }
          @Override
          public Scriptable wrapNewObject(Context cx, Scriptable scope, Object obj) {
            return super.wrapNewObject(cx, scope, obj);
          }
          @Override
          public Scriptable wrapAsJavaObject(Context cx, Scriptable scope, Object javaObject, Class staticType) {
            return new SandboxNativeJavaObject(scope, javaObject, staticType);
          }           
        });
        return cx;
      }       
    });
    ContextFactory factory = ContextFactory.getGlobal();
    factory.initApplicationClassLoader(new SandboxClassLoader(TurtleSpecSection2_2Test.class.getClassLoader()));   
  }
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory

   *
   * TODO: make the custom classloader work (at not loading all the Java classes).
   */
  @BeforeClass
  public static void messWithClassLoader() {
    ContextFactory.initGlobal(new ContextFactory() {
      @Override
      protected Context makeContext() {
        Context cx = super.makeContext();
        cx.setWrapFactory(new WrapFactory() {
          @Override
          public Object wrap(Context cx, Scriptable scope, Object obj, Class staticType) {
            return super.wrap(cx, scope, obj, staticType);
          }
          @Override
          public Scriptable wrapNewObject(Context cx, Scriptable scope, Object obj) {
            return super.wrapNewObject(cx, scope, obj);
          }
          @Override
          public Scriptable wrapAsJavaObject(Context cx, Scriptable scope, Object javaObject, Class staticType) {
            return new SandboxNativeJavaObject(scope, javaObject, staticType);
          }           
        });
        return cx;
      }       
    });
    ContextFactory factory = ContextFactory.getGlobal();
    factory.initApplicationClassLoader(new SandboxClassLoader(TurtleSpecSection2_2Test.class.getClassLoader()));   
  }
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory

     *
     * TODO: make the custom class loader work (at not loading all the Java classes).
     */
    @BeforeClass
    public static void messWithClassLoader() {
      ContextFactory.initGlobal(new ContextFactory() {
        @Override
        protected Context makeContext() {
          Context cx = super.makeContext();
          cx.setWrapFactory(new WrapFactory() {
            @Override
            public Object wrap(Context cx, Scriptable scope, Object obj, Class staticType) {
              return super.wrap(cx, scope, obj, staticType);
            }
            @Override
            public Scriptable wrapNewObject(Context cx, Scriptable scope, Object obj) {
              return super.wrapNewObject(cx, scope, obj);
            }
            @Override
            public Scriptable wrapAsJavaObject(Context cx, Scriptable scope, Object javaObject, Class staticType) {
              return new SandboxNativeJavaObject(scope, javaObject, staticType);
            }           
          });
          return cx;
        }       
      });
      ContextFactory factory = ContextFactory.getGlobal();
      factory.initApplicationClassLoader(new SandboxClassLoader(TurtleSpecSection2_1Test.class.getClassLoader()));   
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.