Package org.apache.tuscany.sca.context

Examples of org.apache.tuscany.sca.context.CompositeContext


                    DomainRegistryFactory domainRegistryFactory = ExtensibleDomainRegistryFactory.getInstance(nodeFactory.registry);
                    DomainRegistry domainRegistry =
                        domainRegistryFactory.getEndpointRegistry(configuration.getDomainRegistryURI(), configuration.getDomainURI());

                    this.compositeContext =
                        new CompositeContext(nodeFactory.registry,
                                             domainRegistry,
                                             domainComposite,
                                             configuration.getDomainURI(),
                                             configuration.getURI(),
                                             nodeFactory.getDeployer().getSystemDefinitions());
View Full Code Here


            if (o instanceof ClassLoader) {
                contribution.setClassLoader((ClassLoader)o);       
            }
        }

        compositeContext = new CompositeContext(extensionPointRegistry,
                                                domainRegistry,
                                                builtComposite,
                                                null, // nothing appears to use the domain name in CompositeContext
                                                null, // don't need node uri
                                                deployer.getSystemDefinitions());
View Full Code Here

        endpointReference.getInvocationChains();
    }

    public void stop(RuntimeEndpointReference epr) {
        if (epr.isStarted()) {
            CompositeContext compositeContext = epr.getCompositeContext();
            if (compositeContext == null) {
                throw new IllegalStateException("The endpoint reference is not bound");
            }
            compositeContext.getEndpointRegistry().removeEndpointReference(epr);
            ReferenceBindingProvider bindingProvider = epr.getBindingProvider();
            if (bindingProvider != null) {
                try {
                    bindingProvider.stop();
                } catch (Throwable ex){
View Full Code Here

     * Create the async callback endpoint for a reference that is going to invoke an asyncInvocation service
     * @param epr - the RuntimeEndpointReference for which the callback is created
     * @return - a RuntimeEndpoint representing the callback endpoint
     */
    private RuntimeEndpoint createAsyncCallbackEndpoint(RuntimeEndpointReference epr) {
        CompositeContext compositeContext = epr.getCompositeContext();
        RuntimeAssemblyFactory assemblyFactory = getAssemblyFactory(compositeContext);
        RuntimeEndpoint endpoint = (RuntimeEndpoint)assemblyFactory.createEndpoint();
        endpoint.bind(compositeContext);

        // Create a pseudo-component and pseudo-service
        // - need to end with a chain with an invoker into the AsyncCallbackHandler class
        RuntimeComponent fakeComponent = null;
        try {
            fakeComponent = (RuntimeComponent)epr.getComponent().clone();
            applyImplementation(fakeComponent);
        } catch (CloneNotSupportedException e2) {
            // will not happen
        } // end try
        endpoint.setComponent(fakeComponent);

        // Create pseudo-service
        ComponentService service = assemblyFactory.createComponentService();
        ExtensionPointRegistry registry = compositeContext.getExtensionPointRegistry();
        FactoryExtensionPoint modelFactories = registry.getExtensionPoint(FactoryExtensionPoint.class);
        JavaInterfaceFactory javaInterfaceFactory =
            (JavaInterfaceFactory)modelFactories.getFactory(JavaInterfaceFactory.class);
        JavaInterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
        try {
View Full Code Here

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

        bind(compositeContext.getExtensionPointRegistry(), compositeContext.getEndpointRegistry());
    }

    public void bind(ExtensionPointRegistry registry, EndpointRegistry endpointRegistry) {
        if (compositeContext == null) {
            compositeContext = new CompositeContext(registry, endpointRegistry);
        }
        this.registry = registry;
        UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
        this.interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class);
        this.workScheduler = utilities.getUtility(WorkScheduler.class);
View Full Code Here

     * Creates the Endpoint object for the async callback
     * @param endpoint - the endpoint which has the async server operations
     * @return the EndpointReference object representing the callback
     */
    private RuntimeEndpointReference createAsyncEPR( RuntimeEndpoint endpoint ){
      CompositeContext compositeContext = endpoint.getCompositeContext();
      RuntimeAssemblyFactory assemblyFactory = getAssemblyFactory( compositeContext );
        RuntimeEndpointReference epr = (RuntimeEndpointReference)assemblyFactory.createEndpointReference();
        epr.bind( compositeContext );
       
        // Create pseudo-reference
        ComponentReference reference = assemblyFactory.createComponentReference();
      ExtensionPointRegistry registry = compositeContext.getExtensionPointRegistry();
        FactoryExtensionPoint modelFactories = registry.getExtensionPoint(FactoryExtensionPoint.class);
        JavaInterfaceFactory javaInterfaceFactory = (JavaInterfaceFactory)modelFactories.getFactory(JavaInterfaceFactory.class);
        JavaInterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
        try {
      interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(AsyncResponseHandler.class));
View Full Code Here

  @SuppressWarnings("unchecked")
  private ServiceReference<AsyncResponseHandler<?>> getAsyncCallbackRef( Message msg ) {
      RuntimeEndpointReference callbackEPR = (RuntimeEndpointReference) msg.getHeaders().get("ASYNC_CALLBACK");
      if( callbackEPR == null ) return null;
     
      CompositeContext compositeContext = callbackEPR.getCompositeContext();
        registry = compositeContext.getExtensionPointRegistry();
      ProxyFactory proxyFactory = ExtensibleProxyFactory.getInstance(registry);
      List<EndpointReference> eprList = new ArrayList<EndpointReference>();
      eprList.add(callbackEPR);
      ObjectFactory<?> factory = new CallbackReferenceObjectFactory(AsyncResponseHandler.class, proxyFactory, eprList);
     
View Full Code Here

                    contributions = nodeFactory.loadContributions(configuration, context);
                }
                domainComposite = nodeFactory.configureNode(configuration, contributions, context);

                this.compositeContext =
                    new CompositeContext(nodeFactory.registry,
                                         endpointRegistry,
                                         domainComposite,
                                         configuration.getDomainURI(),
                                         configuration.getURI(),
                                         nodeFactory.getDeployer().getSystemDefinitions());
View Full Code Here

//        } finally {
//            monitorFactory.setContextMonitor(tcm);
//        }
       
        compositeContext = new CompositeContext(extensionPointRegistry,
                                                endpointRegistry,
                                                domainComposite,
                                                null, // nothing appears to use the domain name in CompositeContext
                                                null, // don't need node uri
                                                deployer.getSystemDefinitions());
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.context.CompositeContext

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.