Package org.apache.tuscany.sca.cpp.tools.common

Examples of org.apache.tuscany.sca.cpp.tools.common.Signature


            List methods = headers.getAllMethods();
           
            // Pull out one of the methods' namespace attributes.
            String intfNamespace = null;
            if (methods.size() > 0) {
                Signature method = (Signature) methods.get(0);
                intfNamespace = method.getNamespace();
            }

            if (interfaceClassNameAttrFromComponentTypeFile != null) {
                methods = filterToPublicMethodsOfGivenClass(methods,
                        interfaceClassNameAttrFromComponentTypeFile, true);
View Full Code Here


     */
    private static List filterToPublicMethodsOfGivenClass(List methods,
            String className, boolean useNamespace) {
        if (methods != null && className != null && className.length() > 0) {
            for (Iterator iter = methods.listIterator(); iter.hasNext();) {
                Signature method = (Signature) iter.next();
                String scope = method.getScope();
                String sig = method.getOriginal();
                String namespace = method.getNamespace();

                String qualifiedClassName;
                if (useNamespace && null != namespace && 0 < namespace.length()) {
                    qualifiedClassName = namespace + "::"
                            + method.getTrimClassName();
                } else {
                    qualifiedClassName = method.getTrimClassName();
                }

                // If we are not public or the classname does not match
                // remove...
                if (!qualifiedClassName.equals(className)
View Full Code Here

            Element intf = (Element) document.createElement(SCA_SERVICE);
            root.appendChild(intf);

            // Go through all the signatures we have collected...
            Signature s = null;
            for (Iterator iter = methods.iterator(); iter.hasNext();) {
                s = (Signature) iter.next();

                // Each signature is an operation
                Element op = document.createElement(SCA_OPERATION);
                op.setAttribute(OPERATION_NAME_ATTR, s.getMethodName());
                intf.appendChild(op);

                Parameter[] parms = s.getParameters();
                if (parms != null) {

                    for (int i = 0; i < parms.length; i++) {
                        Element parm = (Element) document
                                .createElement(SCA_OPERATION_PARAMETER);
                        String type_string = parms[i].getTypeWithoutConst()
                                .toString();

                        type_string = type_string.replaceAll(":: ", "::");

                        Text text = document.createTextNode(type_string);
                        parm.appendChild(text);
                        parm.setAttribute(SCA_OPERATION_PARAMETER_NAME_ATTR,
                                parms[i].getName());

                        if (parms[i].getTypeWithoutConst().intern() != parms[i]
                                .getType().intern()) {
                            parm.setAttribute(
                                    SCA_OPERATION_PARAMETER_CONST_ATTR, "true");
                        }

                        op.appendChild(parm);
                        // TO DO only really stores the value
                        // unsafely/temporarily
                        // which is fine while we handle everything at the
                        // end of parsing the "leaf" that represents that actual
                        // interface/service but the below will cause the second
                        // service
                        // processed to overwite the first one in the DOM. I we
                        // wish
                        // to do some overall processing at the end we will have
                        // to
                        // use a better more XPath like key that varies by
                        // instance
                        // of the service.
                        intf.setAttribute(SCA_INTERFACE_NAME_ATTR, s
                                .getTrimClassName());
                    }
                }

                Element rc = document.createElement(SCA_OPERATION_RETURN_TYPE);
                rc.appendChild(document.createTextNode(s.getReturnType()
                        .toString().replaceAll(":: ", "::")));
                op.appendChild(rc);

                root.appendChild(intf);
            }

            // Set the name of the Service
            // here, if we are not passed one we use
            // the classname from the last header function signature...
            if (serviceName == null && s != null) {
                serviceName = s.getTrimClassName();
            }

            // this is used for the proxy file name but we need to
            // use the reference name if this is pulled in due to it
            // being a reference!!!
View Full Code Here

                return implementationCppClass;
            }
        } else {
            // Implementation class is null so we return the fully qualified classname of the
            // first service method
            Signature s = (Signature) methods.get(0);
            String className = s.getTrimClassName();
            String namespace = s.getNamespace();
            if( namespace != null && namespace.length() > 0)
            {
                className = namespace + "::" + className;
            }
           
View Full Code Here

                || implementationCppClass.length() == 0) {
            return null;
        }

        for (Iterator iter = methods.listIterator(); iter.hasNext();) {
            Signature method = (Signature) iter.next();

            String className = method.getTrimClassName();
            String namespace = method.getNamespace();

            if (namespace != null && namespace.length() > 0) {
                className = namespace + "::" + className;
            }
View Full Code Here

        if (null == methods) {
            return null;
        }

        for (Iterator iter = methods.listIterator(); iter.hasNext();) {
            Signature method = (Signature) iter.next();

            if (method.isConstructor() || method.isDestructor()) {
                iter.remove();
            }
        }

        return methods;
View Full Code Here

                return implementationCppClass;
            }
        } else {
            // Implementation class is null so we return the fully qualified classname of the
            // first service method
            Signature s = (Signature) methods.get(0);
            String className = s.getTrimClassName();
            String namespace = s.getNamespace();
            if( namespace != null && namespace.length() > 0)
            {
                className = namespace + "::" + className;
            }
           
View Full Code Here

                || implementationCppClass.length() == 0) {
            return null;
        }

        for (Iterator iter = methods.listIterator(); iter.hasNext();) {
            Signature method = (Signature) iter.next();

            String className = method.getTrimClassName();
            String namespace = method.getNamespace();

            if (namespace != null && namespace.length() > 0) {
                className = namespace + "::" + className;
            }
View Full Code Here

        if (null == methods) {
            return null;
        }

        for (Iterator iter = methods.listIterator(); iter.hasNext();) {
            Signature method = (Signature) iter.next();

            if (method.isConstructor() || method.isDestructor()) {
                iter.remove();
            }
        }

        return methods;
View Full Code Here

            List methods = headers.getAllMethods();
           
            // Pull out one of the methods' namespace attributes.
            String intfNamespace = null;
            if (methods.size() > 0) {
                Signature method = (Signature) methods.get(0);
                intfNamespace = method.getNamespace();
            }

            if (interfaceClassNameAttrFromComponentTypeFile != null) {
                methods = filterToPublicMethodsOfGivenClass(methods,
                        interfaceClassNameAttrFromComponentTypeFile, true);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.cpp.tools.common.Signature

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.