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

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


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

        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


            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

       
        // 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

        }
       
        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);
    }
View Full Code Here

*/
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

            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

                Class<?> cls =
                    RootResourceClassGenerator.generateRootResourceClass(interfaze,
                                                                         path,
                                                                         requestMediaType,
                                                                         responseMediaType);
                ProxyFactory proxyFactory = ExtensibleProxyFactory.getInstance(extensionPoints);
                Object proxy = proxyFactory.createProxy(interfaze, endpoint);
                RootResourceClassGenerator.injectProxy(cls, proxy);
                return cls;
            } catch (Exception e) {
                throw new ServiceRuntimeException(e);
            }
View Full Code Here

            }
           
            FactoryExtensionPoint factories = extensionsRegistry.getExtensionPoint(FactoryExtensionPoint.class);
            AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
            JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
            ProxyFactory proxyFactory = new ExtensibleProxyFactory(extensionsRegistry.getExtensionPoint(ProxyFactoryExtensionPoint.class));

            String client = "sca.client." + UUID.randomUUID();
            CompositeContext compositeContext =
                new CompositeContext(extensionsRegistry, endpointRegistry, null, domainURI.toString(), client, nodeFactory.getDeployer().getSystemDefinitions());

            List<Endpoint> eps = endpointRegistry.findEndpoint(serviceName);
            if (eps == null || eps.size() < 1) {
                throw new NoSuchServiceException(serviceName);
            }
            Endpoint endpoint = eps.get(0); // TODO: what should be done with multiple endpoints?
          
            RuntimeEndpointReference epr;
            try {
                epr = createEndpointReference(javaInterfaceFactory, compositeContext, assemblyFactory, endpoint, serviceInterface);
            } catch (Exception e) {
                throw new ServiceRuntimeException(e);
            }

            InvocationHandler handler = Proxy.getInvocationHandler(proxyFactory.createProxy(serviceInterface, epr));
            return handler.invoke(proxy, method, args);
           
        } finally {
            nodeFactory.destroy();
        }
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

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.