Package org.apache.tuscany.core.context

Examples of org.apache.tuscany.core.context.ContextInitException


        String key = wsdlDef.getDocumentBaseURI();
        URL url;
        try {
            url = new URL(key);
        } catch (MalformedURLException e) {
            throw new ContextInitException(e);
        }

        EndpointReferenceType reference = EndpointReferenceUtils.getEndpointReference(url,
                wsBinding.getWSDLService().getQName(),
                wsBinding.getWSDLPort().getName());
       
        AttributedURIType address = new AttributedURIType();

        String bindingId = null;
        Binding binding = wsBinding.getWSDLPort().getBinding();
        if (null != binding) {
            List list = binding.getExtensibilityElements();
            if (!list.isEmpty()) {
                bindingId = ((ExtensibilityElement)list.get(0)).getElementType().getNamespaceURI();
            }
        }
        List<?> list = wsBinding.getWSDLPort().getExtensibilityElements();
        for (Object ep : list) {
            ExtensibilityElement ext = (ExtensibilityElement)ep;
            if (ext instanceof SOAPAddress) {
                if (bindingId == null) {
                    bindingId = ((SOAPAddress)ext).getLocationURI();
                }
                address.setValue(((SOAPAddress)ext).getLocationURI());
            }
            if (ext instanceof AddressType) {
                if (bindingId == null) {
                    bindingId = ((AddressType)ext).getLocation();
                }
                address.setValue(((AddressType)ext).getLocation());
            }
        }
        if (reference.getAddress() == null) {
            //REVIST - bug in Celtix that the HTTP transport won't find the address correctly
            reference.setAddress(address);
        }
       
        try {
            serverBinding = bus.getBindingManager().getBindingFactory(bindingId).createServerBinding(
                    reference, this);
            serverBinding.activate();
        } catch (Exception e) {
            throw new ContextInitException(e);
        }       
    }
View Full Code Here


        if (getLifecycleState() != UNINITIALIZED && getLifecycleState() != STOPPED) {
            throw new IllegalStateException("Component must be in UNINITIALIZED state [" + getLifecycleState() + "]");
        }
        if (objectFactory == null) {
            lifecycleState = ERROR;
            ContextInitException e = new ContextInitException("Object factory not found ");
            e.setIdentifier(getName());
            throw e;
        }
        lifecycleState = INITIALIZED;
    }
View Full Code Here

                    scope.start();
                }
                lifecycleState = RUNNING;
            } catch (WireFactoryInitException e) {
                lifecycleState = ERROR;
                ContextInitException cie = new ContextInitException(e);
                cie.addContextName(getName());
                throw cie;
            } catch (CoreRuntimeException e) {
                lifecycleState = ERROR;
                e.addContextName(getName());
                throw e;
View Full Code Here

        if (!initialized) {
            try {
                /* block until the module has initialized */
                boolean success = initializeLatch.await(DEFAULT_WAIT, TimeUnit.MILLISECONDS);
                if (!success) {
                    throw new ContextInitException("Timeout waiting for module context to initialize");
                }
            } catch (InterruptedException e) { // should not happen
            }
        }

View Full Code Here

            for (SourceWireFactory<?> sourceFactory : source.getSourceWireFactories()) {
                WireConfiguration wireConfiguration = sourceFactory.getConfiguration();
                QualifiedName targetName = wireConfiguration.getTargetName();
                ContextFactory<?> target = configurations.get(targetName.getPartName());
                if (target == null) {
                    ContextInitException e = new ContextInitException("Target not found");
                    e.setIdentifier(targetName.getPartName());
                    e.addContextName(source.getName());
                    e.addContextName(name);
                    throw e;
                }
                // get the proxy chain for the target
                TargetWireFactory targetFactory = target.getTargetWireFactory(targetName.getPortName());
                if (targetFactory == null) {
                    ContextInitException e = new ContextInitException("No proxy factory found for service");
                    e.setIdentifier(wireConfiguration.getTargetName().getPortName());
                    e.addContextName(target.getName());
                    e.addContextName(source.getName());
                    e.addContextName(name);
                    throw e;
                }
                try {
                    boolean downScope = scopeStrategy.downScopeReference(sourceScope, target.getScope());
                    configurationContext.connect(sourceFactory, targetFactory, target.getClass(), downScope, scopeContexts
                            .get(target.getScope()));
                } catch (BuilderConfigException e) {
                    e.addContextName(target.getName());
                    e.addContextName(source.getName());
                    e.addContextName(name);
                    throw e;
                }

            }
        }
        // wire invokers when the proxy only contains the target chain
        if (source.getTargetWireFactories() != null) {
            for (TargetWireFactory targetFactory : source.getTargetWireFactories().values()) {
                try {
                    configurationContext.completeTargetChain(targetFactory, source.getClass(), scopeContexts.get(sourceScope));
                } catch (BuilderConfigException e) {
                    e.addContextName(source.getName());
                    e.addContextName(name);
                    throw e;
                }
            }
        }
    }
View Full Code Here

    public JavaAtomicContext(String name, ObjectFactory objectFactory, boolean eagerInit, EventInvoker<Object> initInvoker,
                             EventInvoker<Object> destroyInvoker, boolean stateless) {
        super(name);
        assert (objectFactory != null) : "Object factory was null";
        if (eagerInit && initInvoker == null) {
            ContextInitException e = new ContextInitException("No intialization method found for implementation");
            e.setIdentifier(getName());
            throw e;
        }
        this.objectFactory = objectFactory;

        this.eagerInit = eagerInit;
View Full Code Here

        if (getLifecycleState() != UNINITIALIZED && getLifecycleState() != STOPPED) {
            throw new IllegalStateException("Context must be in UNINITIALIZED state [" + getLifecycleState() + "]");
        }
        if (objectFactory == null) {
            lifecycleState = ERROR;
            ContextInitException e = new ContextInitException("Object factory not found");
            e.setIdentifier(getName());
            throw e;
        }
        lifecycleState = INITIALIZED;
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.context.ContextInitException

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.