Examples of RuntimeContextImpl


Examples of org.apache.tuscany.core.runtime.RuntimeContextImpl

     */
    public static RuntimeContext createJavaRuntime() throws ConfigurationException {
        MonitorFactory monitorFactory = new NullMonitorFactory();
        ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory);
        DefaultWireBuilder wireBuilder = new DefaultWireBuilder();
        RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, wireBuilder);
        runtime.start();
        runtime.getSystemContext().registerModelObject(createSystemCompositeComponent(SYSTEM_CHILD));
        SystemCompositeContext ctx = (SystemCompositeContext) runtime.getSystemContext().getContext(SYSTEM_CHILD);
        Component comp = systemFactory.createSystemComponent(POLICY_BUILDER_REGISTRY, PolicyBuilderRegistry.class, DefaultPolicyBuilderRegistry.class, Scope.MODULE);
        comp.getImplementation().setComponentType(getIntrospector().introspect(DefaultPolicyBuilderRegistry.class));
        ctx.registerModelObject(comp);
        comp = systemFactory.createSystemComponent(MESSAGE_FACTORY, MessageFactory.class, MessageFactoryImpl.class, Scope.MODULE);
        comp.getImplementation().setComponentType(getIntrospector().introspect(MessageFactoryImpl.class));
View Full Code Here

Examples of org.apache.tuscany.core.runtime.RuntimeContextImpl

        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        AssemblyContext modelContext = BootstrapHelper.getModelContext(classLoader);

        // Create a runtime context and start it
        ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory);
        runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, new DefaultWireBuilder());
        runtime.start();

        // Load and start the system configuration
        SystemCompositeContext systemContext = runtime.getSystemContext();
        BootstrapHelper.bootstrapStaxLoader(systemContext, modelContext);
View Full Code Here

Examples of org.apache.tuscany.core.runtime.RuntimeContextImpl

        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        AssemblyContext modelContext = BootstrapHelper.getModelContext(classLoader);

        // Create a runtime context and start it
        ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory);
        runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, new DefaultWireBuilder());
        runtime.start();

        // Load and start the system configuration
        SystemCompositeContext systemContext = runtime.getSystemContext();
        BootstrapHelper.bootstrapStaxLoader(systemContext, modelContext);
View Full Code Here

Examples of org.apache.tuscany.core.runtime.RuntimeContextImpl

    protected void setUp() throws Exception {
        super.setUp();
        MonitorFactory monitorFactory = new NullMonitorFactory();
        ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory);
        DefaultWireBuilder wireBuilder = new DefaultWireBuilder();
        runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, wireBuilder);
        runtime.start();
        systemContext = runtime.getSystemContext();
        systemContext.publish(new ModuleStart(this));
    }
View Full Code Here

Examples of org.apache.tuscany.core.runtime.RuntimeContextImpl

        // Create and bootstrap an empty Tuscany runtime
        MonitorFactory monitorFactory = new NullMonitorFactory();
        ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory);
        DefaultWireBuilder wireBuilder = new DefaultWireBuilder();
        runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, wireBuilder);
        runtime.start();
    }
View Full Code Here

Examples of org.apache.tuscany.core.runtime.RuntimeContextImpl

        modelLoader = modelContext.getAssemblyLoader();

        // Create and start the runtime
        NullMonitorFactory monitorFactory = new NullMonitorFactory();
        ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory);
        runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, new DefaultWireBuilder());
        runtime.start();

        // Load and start the system configuration
        try {
            SystemCompositeContext systemContext = runtime.getSystemContext();
View Full Code Here

Examples of org.apache.tuscany.core.runtime.RuntimeContextImpl

    /**
     * Creates a default {@link RuntimeContext} configured with support for Java component implementations
     */
    public static RuntimeContext createCoreRuntime() {
        NullMonitorFactory monitorFactory = new NullMonitorFactory();
        RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory), null);
        runtime.start();
        return runtime;
    }
View Full Code Here

Examples of org.apache.tuscany.core.runtime.RuntimeContextImpl

        WireFactoryService wireFactory = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry);
        JavaContextFactoryBuilder javaBuilder = new JavaContextFactoryBuilder(wireFactory);

        builderRegistry.register(javaBuilder);

        RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, defaultWireBuilder);
        runtime.addBuilder(new JavaTargetWireBuilder());
        runtime.start();
        runtime.getRootContext().registerModelObject(
                MockFactory.createCompositeComponent("test.module"));
        CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module");
        child.registerModelObject(MockFactory.createModule());
        child.publish(new ModuleStart(this));
        GenericComponent source = (GenericComponent) child.getContext("source").getInstance(null);
        Assert.assertNotNull(source);
        source.getGenericComponent().getString();
        Assert.assertEquals(1, mockInterceptor.getCount());
        source.getGenericComponent().getString();
        Assert.assertEquals(2, mockInterceptor.getCount());
        child.publish(new ModuleStop(this));
        runtime.stop();
    }
View Full Code Here

Examples of org.apache.tuscany.core.runtime.RuntimeContextImpl

        policyRegistry.registerSourceBuilder(handlerBuilder);
        WireFactoryService wireFactory = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry);
        JavaContextFactoryBuilder javaBuilder = new JavaContextFactoryBuilder(wireFactory);

        builderRegistry.register(javaBuilder);
        RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, defaultWireBuilder);
        runtime.addBuilder(new JavaTargetWireBuilder());
        runtime.start();
        runtime.getRootContext().registerModelObject(
                MockFactory.createCompositeComponent("test.module"));
        CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module");
        child.registerModelObject(MockFactory.createModule());
        child.publish(new ModuleStart(this));
        GenericComponent source = (GenericComponent) child.getContext("source").getInstance(null);
        Assert.assertNotNull(source);
        source.getGenericComponent().getString();
        Assert.assertEquals(1, mockInterceptor.getCount());
        Assert.assertEquals(1, mockHandler.getCount());
        source.getGenericComponent().getString();
        Assert.assertEquals(2, mockInterceptor.getCount());
        Assert.assertEquals(2, mockHandler.getCount());
        child.publish(new ModuleStop(this));
        runtime.stop();
    }
View Full Code Here

Examples of org.apache.tuscany.core.runtime.RuntimeContextImpl

        WireFactoryService wireFactory = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry);
        JavaContextFactoryBuilder javaBuilder = new JavaContextFactoryBuilder(wireFactory);

        builderRegistry.register(javaBuilder);

        RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, defaultWireBuilder);
        runtime.addBuilder(new JavaTargetWireBuilder());
        runtime.start();
        runtime.getRootContext().registerModelObject(
                MockFactory.createCompositeComponent("test.module"));
        CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module");
        child.registerModelObject(MockFactory.createModule());
        child.publish(new ModuleStart(this));
        GenericComponent source = (GenericComponent) child.getContext("source").getInstance(null);
        Assert.assertNotNull(source);
        source.getGenericComponent().getString();
        Assert.assertEquals(1, mockInterceptor.getCount());
        Assert.assertEquals(1, mockHandler.getCount());
        source.getGenericComponent().getString();
        Assert.assertEquals(2, mockInterceptor.getCount());
        Assert.assertEquals(2, mockHandler.getCount());
        child.publish(new ModuleStop(this));
        runtime.stop();
    }
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.