Examples of TargetException


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

    public Object invokeTarget(Object payload) throws InvocationTargetException {
        if (context == null) {
            Context iContext = container.getContext(esName);
            if (!(iContext instanceof ExternalServiceContext)) {
                TargetException te = new TargetException("Unexpected target context type");
                te.setIdentifier(iContext.getClass().getName());
                te.addContextName(iContext.getName());
                throw te;
            }
            context = (ExternalServiceContext)iContext;
        }
        ExternalWebServiceClient client = (ExternalWebServiceClient)context.getHandler();
View Full Code Here

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

        if (scope == null) {
            return null;
        }
        Context ctx = scope.getContext(qName.getPortName());
        if (!(ctx instanceof EntryPointContext)) {
            TargetException e = new TargetException("Target not an entry point");
            e.setIdentifier(qName.getQualifiedName());
            e.addContextName(name);
            throw e;
        }
        return ctx.getInstance(null);
    }
View Full Code Here

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

    public Object invokeTarget(Object payload) throws InvocationTargetException {
        if (context == null) {
            Context iContext = container.getContext(esName);
            if (!(iContext instanceof AtomicContext)) {
                TargetException te = new TargetException("Unexpected target context type");
                te.setIdentifier(iContext.getClass().getName());
                te.addContextName(iContext.getName());
                throw te;
            }
            context = (AtomicContext) iContext;
        }
View Full Code Here

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

    public Object invokeTarget(Object payload) throws InvocationTargetException {
        if (context == null) {
            Context iContext = container.getContext(esName);
            if (!(iContext instanceof ExternalServiceContext)) {
                TargetException te = new TargetException("Unexpected target context type");
                te.setIdentifier(iContext.getClass().getName());
                te.addContextName(iContext.getName());
                throw te;
            }
            context = (ExternalServiceContext) iContext;
        }
View Full Code Here

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

    public Object getInstance(QualifiedName qName) throws TargetException {
        try {
            return targetWireFactory.createProxy();
            // TODO do we cache the proxy, (assumes stateful capabilities will be provided in an interceptor)
        } catch (ProxyCreationException e) {
            TargetException te = new TargetException(e);
            te.addContextName(getName());
            throw te;
        }
    }
View Full Code Here

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

    public Object getInstance(QualifiedName qName) throws TargetException {
        if (proxy == null) {
            try {
                proxy = sourceWireFactory.createProxy();
            } catch (ProxyCreationException e) {
                TargetException te = new TargetException(e);
                te.addContextName(getName());
                throw te;
            }
        }
        return proxy;
    }
View Full Code Here

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

    }

    public Object getInstance(QualifiedName qName) throws TargetException {
        Context context = getContext(qName.getPartName());
        if (context == null) {
            TargetException e = new TargetException("Component not found");
            e.setIdentifier(qName.getQualifiedName());
            throw e;
        }
        return context.getInstance(qName);
    }
View Full Code Here

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

         if (cachedTargetInstance != null) {
            if (destroyInvoker != null) {
                try {
                    destroyInvoker.invokeEvent(cachedTargetInstance);
                } catch (ObjectCallbackException e) {
                    throw new TargetException(e.getCause());
                }
            }
        }
        lifecycleState = STARTED;
    }
View Full Code Here

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

     */
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        Interceptor headInterceptor = null;
        ConfigHolder holder = configuration.get(method);
        if (holder == null) {
            TargetException e = new TargetException("Operation not configured");
            e.setIdentifier(method.getName());
            throw e;
        }
        InvocationConfiguration config = holder.config;
        if (config != null) {
           headInterceptor = config.getHeadInterceptor();
        }

        TargetInvoker invoker;

        if (holder.cachedInvoker == null) {
            assert config != null;
            if(config.getTargetInvoker() == null){
                TargetException e= new TargetException("No target invoker configured for operation");
                e.setIdentifier(config.getMethod().getName());
                throw e;
            }
            if (config.getTargetInvoker().isCacheable()) {
                // clone and store the invoker locally
                holder.cachedInvoker = (TargetInvoker) config.getTargetInvoker().clone();
                invoker = holder.cachedInvoker;
            } else {
                invoker = config.getTargetInvoker();
            }
        } else {
            assert config != null;
            invoker = config.getTargetInvoker();
        }
        if (headInterceptor == null) {
            try {
                // short-circuit the dispatch and invoke the target directly
                if (config.getTargetInvoker() == null) {
                    throw new AssertionError("No target invoker [" + method.getName() + "]");
                }
                return config.getTargetInvoker().invokeTarget(args);
            } catch (InvocationTargetException e) {
                // the cause was thrown by the target so throw it
                throw e.getCause();
            }
        } else {
            Message msg = messageFactory.createMessage();
            msg.setTargetInvoker(invoker);
            msg.setBody(args);
View Full Code Here

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

            // select the correct port, or we need to return a factory that matches the whole set of services exposed by
            // the component.
            targetFactory = targetProxyFactories.values().iterator().next();
        }
        if (targetFactory == null) {
            TargetException e = new TargetException("Target service not found");
            e.setIdentifier(qName.getPortName());
            e.addContextName(getName());
            throw e;
        }
        try {
            Object proxy = targetFactory.createProxy(); //createProxy(new Class[] { iface });
            if (notify) {
                publish(new InstanceCreated(this));
            }
            return proxy;
        } catch (ProxyCreationException e) {
            TargetException te = new TargetException("Error returning target", e);
            e.setIdentifier(qName.getPortName());
            e.addContextName(getName());
            throw te;
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.