Package org.apache.tuscany.spi.component

Examples of org.apache.tuscany.spi.component.SCAObject


    public void addInboundWire(InboundWire wire) {
        //TODO implement
    }

    public InboundWire getInboundWire(String serviceName) {
        SCAObject object = children.get(serviceName);
        if (!(object instanceof Service)) {
            throw new ComponentNotFoundException(serviceName);
        }
        return ((Service) object).getInboundWire();
    }
View Full Code Here


    public TargetInvoker createAsyncTargetInvoker(InboundWire wire, Operation operation) {
        throw new UnsupportedOperationException();
    }

    public Service getService(String name) {
        SCAObject ctx = children.get(name);
        if (ctx == null) {
            ComponentNotFoundException e = new ComponentNotFoundException("Service not found");
            e.setIdentifier(name);
            e.addContextName(getName());
            throw e;
View Full Code Here

        }
        return service.getServiceInstance();
    }

    public Service getSystemService(String name) {
        SCAObject ctx = systemChildren.get(name);
        if (ctx == null) {
            ComponentNotFoundException e = new ComponentNotFoundException("Service not found");
            e.setIdentifier(name);
            e.addContextName(getName());
            throw e;
View Full Code Here

        }
        return (Service) ctx;
    }

    public <T> T locateService(Class<T> serviceInterface, String name) {
        SCAObject target = children.get(name);
        if (target == null) {
            TargetNotFoundException e = new TargetNotFoundException(name);
            e.addContextName(getName());
            throw e;
        }
        return serviceInterface.cast(target.getServiceInstance());
    }
View Full Code Here

        }
        return serviceInterface.cast(target.getServiceInstance());
    }

    public <T> T locateSystemService(Class<T> serviceInterface, String name) {
        SCAObject object = systemChildren.get(name);
        if (object == null) {
            TargetNotFoundException e = new TargetNotFoundException(name);
            e.addContextName(getName());
            throw e;
        }
        return serviceInterface.cast(object.getServiceInstance());
    }
View Full Code Here

        }
        return serviceInterface.cast(object.getServiceInstance());
    }

    public Object getServiceInstance(String name) throws TargetException {
        SCAObject context = children.get(name);
        if (context == null) {
            TargetNotFoundException e = new TargetNotFoundException(name);
            e.addContextName(getName());
            throw e;
        } else if (context instanceof Service) {
            return context.getServiceInstance();
        } else {
            IllegalTargetException e = new IllegalTargetException("Target must be a service");
            e.setIdentifier(name);
            e.addContextName(getName());
            throw e;
View Full Code Here

            throw e;
        }
    }

    public Object getSystemServiceInstance(String name) throws TargetException {
        SCAObject target = systemChildren.get(name);
        if (target == null) {
            TargetNotFoundException e = new TargetNotFoundException(name);
            e.addContextName(getName());
            throw e;
        } else if (target instanceof Service) {
            return target.getServiceInstance();
        } else {
            IllegalTargetException e = new IllegalTargetException("Target must be a service");
            e.setIdentifier(name);
            e.addContextName(getName());
            throw e;
View Full Code Here

    public <T> T resolveInstance(Class<T> instanceInterface) throws AutowireResolutionException {
        if (CompositeComponent.class.equals(instanceInterface)) {
            return instanceInterface.cast(this);
        }
        SCAObject context = autowireInternal.get(instanceInterface);
        if (context != null) {
            try {
                if (context instanceof AtomicComponent || context instanceof Reference || context instanceof Service) {
                    return instanceInterface.cast(context.getServiceInstance());
                } else {
                    IllegalTargetException e = new IllegalTargetException("Autowire target must be a system "
                        + "service, atomic component, or reference");
                    e.setIdentifier(instanceInterface.getName());
                    e.addContextName(getName());
View Full Code Here

    public <T> T resolveSystemInstance(Class<T> instanceInterface) throws AutowireResolutionException {
        if (CompositeComponent.class.equals(instanceInterface)) {
            return instanceInterface.cast(this);
        }
        SCAObject context = systemAutowireInternal.get(instanceInterface);
        if (context != null) {
            try {
                if (context instanceof AtomicComponent || context instanceof Reference || context instanceof Service) {
                    return instanceInterface.cast(context.getServiceInstance());
                } else {
                    IllegalTargetException e = new IllegalTargetException("Autowire target must be a system "
                        + "service, atomic component, or reference");
                    e.setIdentifier(instanceInterface.getName());
                    e.addContextName(getName());
View Full Code Here

        public Object getBean(String name) throws BeansException {
            return getBean(name, null);
        }

        public Object getBean(String name, Class requiredType) throws BeansException {
            SCAObject object = children.get(name);   // keep cast due to compiler error
            if (object == null) {
                return null;
            }
            Class<?> type;
            if (object instanceof Reference) {
                type = ((Reference) object).getInterface();
            } else if (object instanceof Service) {
                type = ((Service) object).getInterface();
            } else {
                throw new AssertionError("Illegal object type [" + name + "]");
            }
            if (requiredType != null && requiredType.isAssignableFrom(type)) {
                // need null check since Spring may pass in a null
                throw new BeanNotOfRequiredTypeException(name, requiredType, type);
            }
            return object.getServiceInstance();
        }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.component.SCAObject

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.