Package org.apache.tuscany.sca.core.invocation

Examples of org.apache.tuscany.sca.core.invocation.ProxyFactory


*/
public class CallbackWireObjectFactoryTestCase extends TestCase {

    @SuppressWarnings({"unchecked"})
    public void testCreateInstance() throws Exception {
        ProxyFactory service = createMock(ProxyFactory.class);
        Foo foo = new Foo() {
        };
        EasyMock.expect(service.createCallbackProxy(EasyMock.eq(Foo.class), EasyMock.isA(List.class))).andReturn(foo);
        EasyMock.replay(service);
        List<RuntimeWire> wires = new ArrayList<RuntimeWire>();
        CallbackWireObjectFactory factory = new CallbackWireObjectFactory(Foo.class, service, wires);
        assertEquals(foo, factory.getInstance());
        EasyMock.verify(service);
View Full Code Here


        // Create Message factory
        MessageFactory messageFactory = new MessageFactoryImpl();
        factories.addFactory(messageFactory);

        // Create a proxy factory
        ProxyFactory proxyFactory = ReallySmallRuntimeBuilder.createProxyFactory(registry, mapper, messageFactory);

        // Create model factories
        assemblyFactory = new RuntimeAssemblyFactory(mapper, proxyFactory);
        factories.addFactory(assemblyFactory);
        PolicyFactory policyFactory = new DefaultPolicyFactory();
View Full Code Here

            reference.setInterfaceContract(interfaceContract);
            component.getReferences().add(reference);
            reference.setComponent(component);
            reference.getBindings().add(binding);
   
            ProxyFactory proxyFactory = compositeActivator.getProxyFactory();
            return new ServiceReferenceImpl<B>(businessInterface, component, reference, binding, proxyFactory, compositeActivator);
           
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        }
View Full Code Here

        RequestContextFactory requestContextFactory = contextFactories.getFactory(RequestContextFactory.class);

        Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassNames = null;
        policyHandlerClassNames = PolicyHandlerDefinitionsLoader.loadPolicyHandlerClassnames();
       
        ProxyFactory proxyFactory = new ExtensibleProxyFactory(proxyFactories);
       
        JavaImplementationProviderFactory javaImplementationProviderFactory =
            new JavaImplementationProviderFactory(proxyFactory, dataBindings, factory, componentContextFactory,
                                                  requestContextFactory, policyHandlerClassNames);
View Full Code Here

        }
       
        Class<?> type = ((JavaInterface)rcs.getInterfaceContract().getInterface()).getJavaClass();

        // Create a Java proxy to the target service
        ProxyFactory proxyFactory = new JDKProxyFactory();
        Object proxy = proxyFactory.createProxy(type, rcs.getRuntimeWire(binding));

        servlet.addService(binding.getName(), type, proxy);

        servletHost.addServletMapping(SERVLET_PATH, servlet);
    }
View Full Code Here

       
        // Determine the service business interface
        Class<?> serviceInterface = getTargetJavaClass(service.getInterfaceContract().getInterface());

        // Create a Java proxy to the target service
        ProxyFactory proxyFactory = new JDKProxyFactory();
        Object proxy = proxyFactory.createProxy(serviceInterface, service.getRuntimeWire(binding));
       
        // Create and register a servlet for this service
        JSONRPCServiceServlet serviceServlet = new JSONRPCServiceServlet(binding.getName(), serviceInterface, proxy);
        int port;
        servletHost.addServletMapping(binding.getURI(), serviceServlet);
View Full Code Here

    public static ProxyFactory createProxyFactory(ExtensionPointRegistry registry,
                                                  InterfaceContractMapper mapper,
                                                  MessageFactory messageFactory) {

        ProxyFactory proxyFactory = new DefaultProxyFactoryExtensionPoint(messageFactory, mapper);

        // FIXME Pass these around differently as they are not extension points
        registry.addExtensionPoint(proxyFactory);
        registry.addExtensionPoint(mapper);
View Full Code Here

            osgiProps.put("sca.reference", component.getURI() + "#reference(" + ref.getName() + ")");
            osgiProps.put(OSGiProperty.OSGI_REMOTE, "true");
            osgiProps.put(OSGiProperty.OSGI_REMOTE_CONFIGURATION_TYPE, "sca");
            osgiProps.put(OSGiProperty.OSGI_REMOTE_INTERFACES, interfaceClass.getName());

            ProxyFactory proxyService = proxyFactoryExtensionPoint.getInterfaceProxyFactory();
            if (!interfaceClass.isInterface()) {
                proxyService = proxyFactoryExtensionPoint.getClassProxyFactory();
            }

            for (RuntimeWire wire : reference.getRuntimeWires()) {
                final Object proxy = proxyService.createProxy(interfaceClass, wire);
                AccessController.doPrivileged(new PrivilegedAction<ServiceRegistration>() {
                    public ServiceRegistration run() {
                        return osgiBundle.getBundleContext()
                            .registerService(interfaceClass.getName(), proxy, osgiProps);
                    }
View Full Code Here

            return null;
        }
        JavaInterface javaInterface = (JavaInterface) callbackReference.getInterfaceContract().getInterface();
        Class<CB> javaClass = (Class<CB>)javaInterface.getJavaClass();
        List<RuntimeWire> wires = callbackReference.getRuntimeWires();
        ProxyFactory proxyFactory = new ExtensibleProxyFactory(proxyFactoryExtensionPoint);
        CallbackReferenceImpl ref = CallbackReferenceImpl.newInstance(javaClass, proxyFactory, wires);
        if (ref != null) { 
            //ref.resolveTarget();
            // TODO - EPR - not required for OASIS
            //ReferenceParameters parameters = msgContext.getFrom().getReferenceParameters();
View Full Code Here

        ContextFactoryExtensionPoint contextFactories = registry.getExtensionPoint(ContextFactoryExtensionPoint.class);
        ComponentContextFactory componentContextFactory = contextFactories.getFactory(ComponentContextFactory.class);
        RequestContextFactory requestContextFactory = contextFactories.getFactory(RequestContextFactory.class);

        ProxyFactory proxyFactory = new ExtensibleProxyFactory(proxyFactories);

        JavaImplementationProviderFactory javaImplementationProviderFactory =
            new JavaImplementationProviderFactory(proxyFactory, dataBindings, factory, componentContextFactory,
                                                  requestContextFactory);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.core.invocation.ProxyFactory

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.