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

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


                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


    private <T> T getRemoteProxy(Class<T> serviceInterface, Endpoint endpoint) throws NoSuchServiceException {
        FactoryExtensionPoint factories = extensionPointRegistry.getExtensionPoint(FactoryExtensionPoint.class);
        AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
        JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
        ProxyFactory proxyFactory =
            new ExtensibleProxyFactory(extensionPointRegistry.getExtensionPoint(ProxyFactoryExtensionPoint.class));

        CompositeContext compositeContext =
            new CompositeContext(extensionPointRegistry, endpointRegistry, null, null, null,
                                 deployer.getSystemDefinitions());

        RuntimeEndpointReference epr;
        try {
            epr =
                createEndpointReference(javaInterfaceFactory,
                                        compositeContext,
                                        assemblyFactory,
                                        endpoint,
                                        serviceInterface);
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        }

        return proxyFactory.createProxy(serviceInterface, epr);
    }
View Full Code Here

        // Determine the service business interface
        Class<?> serviceInterface = getTargetJavaClass(serviceContract.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, componentService, serviceContract, serviceInterface, proxy);
        String mapping = binding.getURI();
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

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

    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

            }

            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));

            CompositeContext compositeContext = new CompositeContext(extensionsRegistry, domainRegistry, null, domainURI, null, null);

            List<Endpoint> eps = domainRegistry.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?
            
            if (serviceInterface == null) {
                try {
                    findInterface(endpoint);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
           
            RuntimeEndpointReference epr;
            try {
                epr = createEndpointReference(javaInterfaceFactory, compositeContext, assemblyFactory, endpoint, serviceInterface);
            } catch (Exception e) {
                throw new ServiceRuntimeException(e);
            }

            this.handler = Proxy.getInvocationHandler(proxyFactory.createProxy(serviceInterface, epr));
        }
        return handler;
    }
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();
            ReferenceParameters parameters = msgContext.getFrom().getReferenceParameters();
            ref.attachCallbackID(parameters.getCallbackID());
View Full Code Here

        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

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.