Package org.apache.tuscany.sca.implementation.java

Examples of org.apache.tuscany.sca.implementation.java.IntrospectionException


        nsContext.register("sca", "http://docs.oasis-open.org/ns/opencsa/sca/200912");
        XPath path = xpathHelper.newXPath();
        try {
            appliesToExpression = xpathHelper.compile(path, nsContext, appliesToString);
        } catch (XPathExpressionException e) {
            throw new IntrospectionException(e);
        }
    }
View Full Code Here


                    ) {
                    Service service;
                    try {
                        service = createService(clazz, interfaze, null);
                    } catch (InvalidInterfaceException e) {
                        throw new IntrospectionException(e);
                    }
                    type.getServices().add(service);
                }
            }
            return;
        }
       
        if (annotation.value().length == 0) {
            throw new IntrospectionException("[JCA90059] The array of interfaces or classes specified by the value attribute of the @Service annotation MUST contain at least one element");
        }
        Class<?>[] interfaces = annotation.value();
        if (annotation.names().length > 0) {
            if (annotation.names().length != interfaces.length) {
                throw new IntrospectionException("[JCA90050] The number of Strings in the names attribute array of the @Service annotation MUST match the number of elements in the value attribute array");
            }
            Set<String> names = new HashSet<String>();
            names.addAll(Arrays.asList(annotation.names()));
            if (names.size() != annotation.names().length) {
                throw new IntrospectionException("[JCA90060] The value of each element in the @Service names array MUST be unique amongst all the other element values in the array");
            }
        }

        //validate no scope on servce interface
        for (Class<?> iface : interfaces) {
            if (iface.getAnnotation(org.oasisopen.sca.annotation.Scope.class) != null) {
                throw new IntrospectionException("[JCA90041] @Scope annotation not allowed on service interface " + iface
                    .getName());
            }
        }
       
        //validate service methods implemented
        Method[] ms = clazz.getMethods();
        for (Class<?> iface : interfaces) {
            for (Method m : iface.getMethods()) {
                if (!hasMethod(m, ms)) {
                    throw new IntrospectionException("[JCA90042,JCI20002] Implementation missing service method " + m.getName() + " service interface " + iface.getName());
                }
            }
        }
       
        for (int i=0; i < interfaces.length; i++) {
            try {
                String name = (annotation.names().length > 0) ? annotation.names()[i] : null;
                Service service = createService(clazz, interfaces[i], name);
                type.getServices().add(service);
            } catch (InvalidInterfaceException e) {
                throw new IntrospectionException(e);
            }
        }
       
    }
View Full Code Here

            if (callInterface.getCallbackClass() != null) {
                JavaInterface callbackInterface = javaInterfaceFactory.createJavaInterface(callInterface.getCallbackClass(), forceRemotable);
                reference.getInterfaceContract().setCallbackInterface(callbackInterface);
            }
        } catch (InvalidInterfaceException e) {
            throw new IntrospectionException(e);
        }
        return reference;
    }
View Full Code Here

            String wsdlLocation = webServiceAnnotation.wsdlLocation();
           
            try {
                createService(type, clazz, serviceName, serviceInterfaceClassName, wsdlLocation, false);
            } catch (InvalidInterfaceException e) {
                throw new IntrospectionException(e);
            }
            hasJaxwsAnnotation = true;
        }
       
        // Process @WebServiceProvider annotation - JCA_11015, POJO_8034
        WebServiceProvider webServiceProviderAnnotation = clazz.getAnnotation(WebServiceProvider.class);
        if (webServiceProviderAnnotation != null) {
            // if the implmentation already has a service set, use it's name
            // and the new service, which uses the implementation as an interface,
            // will be replaced
            String serviceName = clazz.getSimpleName();
           
            if (type.getServices().size() > 0){
                serviceName = ((Service)type.getServices().get(0)).getName();
            }
           
            // the annotation may specify a service name
            serviceName = getValue(webServiceProviderAnnotation.serviceName(), serviceName);
           
            String wsdlLocation = webServiceProviderAnnotation.wsdlLocation();
           
            // Make sure that there is a service with an interface
            // based on the implementation class and have it replace
            // any service with the same name
            try {
                createService(type, clazz, serviceName, null, wsdlLocation, true);
            } catch (InvalidInterfaceException e) {
                throw new IntrospectionException(e);
            }
           
            // Make sure all service references are remotable
            for ( Service service : type.getServices() ) {
                service.getInterfaceContract().getInterface().setRemotable(true);
View Full Code Here

    private void addService(JavaImplementation type, Class<?> clazz) throws IntrospectionException {
        try {
            org.apache.tuscany.sca.assembly.Service service = createService(clazz);
            type.getServices().add(service);
        } catch (InvalidInterfaceException e) {
            throw new IntrospectionException(e);
        }
    }
View Full Code Here

              reference.setMultiplicity(Multiplicity.ONE_N);
            } else {
              reference.setMultiplicity(Multiplicity.ONE_ONE);
            } // end if
        } catch (InvalidInterfaceException e1) {
            throw new IntrospectionException(e1);
        } // end try

        // FIXME:  This part seems to have already been taken care above!!
        try {
            processCallback(paramType, reference);
        } catch (InvalidServiceTypeException e) {
            throw new IntrospectionException(e);
        }
        return reference;
    }
View Full Code Here

            for (Operation op : service.getInterfaceContract().getInterface().getOperations()) {
                Method method;
                try {
                    method = JavaInterfaceUtil.findMethod(clazz, op);
                } catch (NoSuchMethodException e1) {
                    throw new IntrospectionException(e1);
                }
                if (method != null) {
                    methods.add(method);
                }
            }
View Full Code Here

            scope = JavaScopeImpl.INVALID;
        }
        type.setJavaScope(scope);
       
        if (type.getJavaScope().equals(JavaScopeImpl.INVALID)) {
          throw new IntrospectionException("Invalid scope :" + name + " for " + type.getName());
        }
    }
View Full Code Here

                    ) {
                    Service service;
                    try {
                        service = createService(interfaze);
                    } catch (InvalidInterfaceException e) {
                        throw new IntrospectionException(e);
                    }
                    type.getServices().add(service);
                }
            }
            return;
        }
        Class<?>[] interfaces = annotation.interfaces();
        if (interfaces.length == 0) {
            Class<?> interfaze = annotation.value();
            if (Void.class.equals(interfaze)) {
                //throw new IllegalServiceDefinitionException("No interfaces specified");
                logger.warning("Ignoring @Service annotation.  No interfaces specified. class = "+clazz.getName());
            } else {
                interfaces = new Class<?>[1];
                interfaces[0] = interfaze;
            }
        }
        for (Class<?> interfaze : interfaces) {
            try {
                Service service = createService(interfaze);
                type.getServices().add(service);
            } catch (InvalidInterfaceException e) {
                throw new IntrospectionException(e);
            }
        }
    }
View Full Code Here

            if (callInterface.getCallbackClass() != null) {
                JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
                reference.getInterfaceContract().setCallbackInterface(callbackInterface);
            }
        } catch (InvalidInterfaceException e) {
            throw new IntrospectionException(e);
        }
        return reference;
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.implementation.java.IntrospectionException

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.