Package org.codehaus.jam

Examples of org.codehaus.jam.JMethod


        JMethod getter = it.getGetter();
        return getter != null && it.getSetter() != null && !getter.isStatic() && getter.getAnnotation("openwire:property") != null;
    }

    public boolean isCachedProperty(JProperty it) {
        JMethod getter = it.getGetter();
        if (!isValidProperty(it)) {
            return false;
        }
        JAnnotationValue value = getter.getAnnotation("openwire:property").getValue("cache");
        return value != null && value.asBoolean();
    }
View Full Code Here


                HashMap uniqueMethods = new HashMap();
                XmlSchemaComplexType methodSchemaType;
                XmlSchemaSequence sequence = null;

                for (int i = 0; i < methods.length; i++) {
                    JMethod jMethod = methods[i];

                    String methodName = methods[i].getSimpleName();
                    // no need to think abt this method , since that is system
                    // config method
                    if (excludeMethods.contains(jMethod.getSimpleName())) {
                        continue;
                    }

                    if (uniqueMethods.get(jMethod.getSimpleName()) != null) {
                        throw new Exception(" Sorry we don't support methods overloading !!!! ");
                    }

                    if (!jMethod.isPublic()) {
                        // no need to generate Schema for non public methods
                        continue;
                    }
                    uniqueMethods.put(jMethod.getSimpleName(), jMethod);
                    // create the schema type for the method wrapper

                    uniqueMethods.put(jMethod.getSimpleName(), jMethod);
                    JParameter[] paras = jMethod.getParameters();
                    String parameterNames[] = null;
                    // better to handle void types too
                    parameterNames = methodTable.getParameterNames(methodName);
                    sequence = new XmlSchemaSequence();

                    methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName());
                    methodSchemaType.setParticle(sequence);

                    for (int j = 0; j < paras.length; j++) {
                        JParameter methodParameter = paras[j];
                        JClass paraType = methodParameter.getType();
                        generateSchemaForType(sequence, paraType, (parameterNames != null && parameterNames[j] != null)
                            ? parameterNames[j] : methodParameter.getSimpleName());
                    }
                    // for its return type
                    JClass returnType = jMethod.getReturnType();

                    // better to handle void types too
                    methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + RESPONSE);
                    sequence = new XmlSchemaSequence();
                    methodSchemaType.setParticle(sequence);
                    generateSchemaForType(sequence, returnType, "return");
                }
            } else {
View Full Code Here

            HashMap uniqueMethods = new HashMap();
            XmlSchemaComplexType methodSchemaType = null;
            XmlSchemaSequence sequence = null;
            for (int i = 0; i < methods.length; i++) {
                String methodName = methods[i].getSimpleName();
                JMethod jMethod = methods[i];
                // no need to think abt this method , since that is system
                // config method
                if (excludeMethods.contains(jMethod.getSimpleName())) {
                    continue;
                }
                // if (jMethod.getSimpleName().equals("init")
                // || "setOperationContext".equals(jMethod.getSimpleName())
                // || "destroy".equals(jMethod.getSimpleName()))
                // continue;
                if (uniqueMethods.get(jMethod.getSimpleName()) != null) {
                    throw new Exception(" Sorry we don't support methods overloading !!!! ");
                }

                if (!jMethod.isPublic()) {
                    // no need to generate Schema for non public methods
                    continue;
                }

                uniqueMethods.put(jMethod.getSimpleName(), jMethod);
                JParameter[] paras = jMethod.getParameters();
                String parameterNames[] = null;
                if (paras.length > 0) {
                    parameterNames = methodTable.getParameterNames(methodName);
                    sequence = new XmlSchemaSequence();

                    // create the schema type for the method wrapper
                    methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName());
                    methodSchemaType.setParticle(sequence);
                }

                for (int j = 0; j < paras.length; j++) {
                    JParameter methodParameter = paras[j];
                    JClass paraType = methodParameter.getType();
                    generateSchemaForType(sequence, paraType, (parameterNames != null && parameterNames[j] != null)
                        ? parameterNames[j] : methodParameter.getSimpleName());
                }
                // for its return type
                JClass returnType = jMethod.getReturnType();
                if (!returnType.isVoidType()) {
                    methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + RESPONSE);
                    sequence = new XmlSchemaSequence();
                    methodSchemaType.setParticle(sequence);
                    generateSchemaForType(sequence, returnType, "return");
                }
            }
View Full Code Here

        Hashtable namespaceMap = new Hashtable();
        String namespacePrefix = null;
        String namespaceURI = null;
        QName messagePartType = null;
        for (int i = 0; i < method.length; i++) {
            JMethod jmethod = method[i];

            if (jmethod.isPublic()) {
                // Request Message
                OMElement requestMessge = fac.createOMElement(MESSAGE_LOCAL_NAME, wsdl);
                requestMessge.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName() + MESSAGE_SUFFIX, null);
                definitions.addChild(requestMessge);

                // only if a type for the message part has already been defined
                if ((messagePartType =
                    typeTable.getComplexSchemaTypeName(generationParams.getSchemaTargetNamespace(), jmethod
                        .getSimpleName())) != null) {
                    namespaceURI = messagePartType.getNamespaceURI();
                    // avoid duplicate namespaces
                    if ((namespacePrefix = (String)namespaceMap.get(namespaceURI)) == null) {
                        namespacePrefix = generatePrefix();
                        namespaceMap.put(namespaceURI, namespacePrefix);
                    }

                    OMElement requestPart = fac.createOMElement(PART_ATTRIBUTE_NAME, wsdl);
                    requestMessge.addChild(requestPart);
                    requestPart.addAttribute(ATTRIBUTE_NAME, "part1", null);

                    requestPart.addAttribute(ELEMENT_ATTRIBUTE_NAME, namespacePrefix + COLON_SEPARATOR
                        + jmethod.getSimpleName(), null);
                }

                // only if a type for the message part has already been defined
                if ((messagePartType =
                    typeTable.getComplexSchemaTypeName(generationParams.getSchemaTargetNamespace(), jmethod
                        .getSimpleName() + RESPONSE)) != null) {
                    namespaceURI = messagePartType.getNamespaceURI();
                    if ((namespacePrefix = (String)namespaceMap.get(namespaceURI)) == null) {
                        namespacePrefix = generatePrefix();
                        namespaceMap.put(namespaceURI, namespacePrefix);
                    }
                    // Response Message
                    OMElement responseMessge = fac.createOMElement(MESSAGE_LOCAL_NAME, wsdl);
                    responseMessge.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName() + RESPONSE_MESSAGE, null);
                    definitions.addChild(responseMessge);
                    OMElement responsePart = fac.createOMElement(PART_ATTRIBUTE_NAME, wsdl);
                    responseMessge.addChild(responsePart);
                    responsePart.addAttribute(ATTRIBUTE_NAME, "part1", null);

                    responsePart.addAttribute(ELEMENT_ATTRIBUTE_NAME, namespacePrefix + COLON_SEPARATOR
                        + jmethod.getSimpleName()
                        + RESPONSE, null);
                }
            }
        }
View Full Code Here

    /**
     * Generate the porttypes
     */
    private void generatePortType(OMFactory fac, OMElement defintions) {
        JMethod jmethod = null;
        OMElement operation = null;
        OMElement message = null;
        OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME, wsdl);
        defintions.addChild(portType);
        // changed default PortType name to match Java interface name
        // instead of appending "PortType".
        portType.addAttribute(ATTRIBUTE_NAME, generationParams.getServiceName(), null);
        // adding message refs
        for (int i = 0; i < method.length; i++) {
            jmethod = method[i];

            if (jmethod.isPublic()) {
                operation = fac.createOMElement(OPERATION_LOCAL_NAME, wsdl);
                portType.addChild(operation);
                operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(), null);

                message = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl);
                message.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix() + COLON_SEPARATOR
                    + jmethod.getSimpleName()
                    + MESSAGE_SUFFIX, null);
                operation.addChild(message);

                if (!jmethod.getReturnType().isVoidType() ||
                    jmethod.getAnnotation("org.osoa.sca.annotations.OneWay") == null) {
                    message = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl);
                    message.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix() + COLON_SEPARATOR
                        + jmethod.getSimpleName()
                        + RESPONSE_MESSAGE, null);
                    operation.addChild(message);
                }
            }
        }
View Full Code Here

        addExtensionElement(fac, binding, soap, BINDING_LOCAL_NAME, TRANSPORT, TRANSPORT_URI, STYLE, generationParams
            .getStyle());

        for (int i = 0; i < method.length; i++) {
            JMethod jmethod = method[i];
            if (jmethod.isPublic()) {
                OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, wsdl);
                binding.addChild(operation);

                addExtensionElement(fac,
                                    operation,
                                    soap,
                                    OPERATION_LOCAL_NAME,
                                    SOAP_ACTION,
                                    URN_PREFIX + COLON_SEPARATOR + jmethod.getSimpleName(),
                                    STYLE,
                                    generationParams.getStyle());
                operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(), null);

                OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl);
                addExtensionElement(fac,
                                    input,
                                    soap,
                                    SOAP_BODY,
                                    SOAP_USE,
                                    generationParams.getUse(),
                                    "namespace",
                                    generationParams.getTargetNamespace());
                operation.addChild(input);

                if (!jmethod.getReturnType().isVoidType()) {
                    OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl);
                    addExtensionElement(fac,
                                        output,
                                        soap,
                                        SOAP_BODY,
View Full Code Here

        addExtensionElement(fac, binding, soap12, BINDING_LOCAL_NAME, TRANSPORT, TRANSPORT_URI, STYLE, generationParams
            .getStyle());

        for (int i = 0; i < method.length; i++) {
            JMethod jmethod = method[i];

            if (jmethod.isPublic()) {
                OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, wsdl);
                binding.addChild(operation);
                operation.declareNamespace(URI_WSDL12_SOAP, SOAP12_PREFIX);

                addExtensionElement(fac,
                                    operation,
                                    soap12,
                                    OPERATION_LOCAL_NAME,
                                    SOAP_ACTION,
                                    URN_PREFIX + COLON_SEPARATOR + jmethod.getSimpleName(),
                                    STYLE,
                                    generationParams.getStyle());
                operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(), null);

                OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl);
                addExtensionElement(fac,
                                    input,
                                    soap12,
                                    SOAP_BODY,
                                    SOAP_USE,
                                    generationParams.getUse(),
                                    "namespace",
                                    generationParams.getTargetNamespace());
                operation.addChild(input);

                if (!jmethod.getReturnType().isVoidType()) {
                    OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl);
                    addExtensionElement(fac,
                                        output,
                                        soap12,
                                        SOAP_BODY,
View Full Code Here

            XmlSchemaSequence sequence = null;
            QName methodPartSchemaTypeName = null;
            for (int i = 0; i < methods.length; i++)
            {
                String methodName = methods[i].getSimpleName();
                JMethod jMethod = methods[i];
                // no need to think abt this method , since that is system
                // config method
                if (excludeMethods.contains(jMethod.getSimpleName())) {
                    continue;
                }
                //if (jMethod.getSimpleName().equals("init")
                //   || "setOperationContext".equals(jMethod.getSimpleName())
                //   || "destroy".equals(jMethod.getSimpleName()))
                //  continue;
                if (uniqueMethods.get(jMethod.getSimpleName()) != null) {
                    throw new Exception(
                            " Sorry we don't support methods overloading !!!! ");
                }

                if (!jMethod.isPublic()) {
                    // no need to generate Schema for non public methods
                    continue;
                }
               
               uniqueMethods.put(jMethod.getSimpleName(), jMethod);
                JParameter [] paras = jMethod.getParameters();
                String parameterNames [] = null;
                if (paras.length > 0)
                {
                    parameterNames = methodTable.getParameterNames(methodName);
                    sequence = new XmlSchemaSequence();
                   
                    //create the schema type for the method wrapper
                    methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName());
                    methodSchemaType.setParticle(sequence);
                }
               
                for (int j = 0; j < paras.length; j++)
                {
                    JParameter methodParameter = paras[j];
                    JClass paraType = methodParameter.getType();
                    generateSchemaForType(sequence, paraType,
                            ( parameterNames != null && parameterNames[j] != null )? parameterNames[j] : methodParameter.getSimpleName());
                }
                // for its return type
                JClass returnType = jMethod.getReturnType();
                QName methodReturnSchemaTypeName = null;
               
                if (!returnType.isVoidType())
                {
                    methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + RESPONSE);
                    sequence = new XmlSchemaSequence();
                    methodSchemaType.setParticle(sequence);
                    generateSchemaForType(sequence, returnType, "return");
                }
            }
View Full Code Here

        Hashtable namespaceMap = new Hashtable();
        String namespacePrefix = null;
        String namespaceURI = null;
        QName messagePartType = null;
        for (int i = 0; i < method.length; i++) {
            JMethod jmethod = method[i];

            if (jmethod.isPublic()) {
                // Request Message
                OMElement requestMessge = fac.createOMElement(MESSAGE_LOCAL_NAME,
                                                              wsdl);
                requestMessge.addAttribute(ATTRIBUTE_NAME,
                                           jmethod.getSimpleName() + MESSAGE_SUFFIX,
                                           null);
                definitions.addChild(requestMessge);

                // only if a type for the message part has already been defined
                if ((messagePartType = typeTable.getComplexSchemaTypeName(generationParams.getSchemaTargetNamespace(),
                                                                          jmethod.getSimpleName())) != null) {
                    namespaceURI = messagePartType.getNamespaceURI();
                    // avoid duplicate namespaces
                    if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) {
                        namespacePrefix = generatePrefix();
                        namespaceMap.put(namespaceURI,
                                         namespacePrefix);
                    }

                    OMElement requestPart = fac.createOMElement(PART_ATTRIBUTE_NAME,
                                                                wsdl);
                    requestMessge.addChild(requestPart);
                    requestPart.addAttribute(ATTRIBUTE_NAME,
                                             "part1",
                                             null);

                    requestPart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
                                             namespacePrefix + COLON_SEPARATOR
                                                     + jmethod.getSimpleName(),
                                             null);
                }

                // only if a type for the message part has already been defined
                if ((messagePartType = typeTable.getComplexSchemaTypeName(generationParams.getSchemaTargetNamespace(),
                                                                          jmethod.getSimpleName()
                                                                                  + RESPONSE)) != null) {
                    namespaceURI = messagePartType.getNamespaceURI();
                    if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) {
                        namespacePrefix = generatePrefix();
                        namespaceMap.put(namespaceURI,
                                         namespacePrefix);
                    }
                    // Response Message
                    OMElement responseMessge = fac.createOMElement(MESSAGE_LOCAL_NAME,
                                                                   wsdl);
                    responseMessge.addAttribute(ATTRIBUTE_NAME,
                                                jmethod.getSimpleName() + RESPONSE_MESSAGE,
                                                null);
                    definitions.addChild(responseMessge);
                    OMElement responsePart = fac.createOMElement(PART_ATTRIBUTE_NAME,
                                                                 wsdl);
                    responseMessge.addChild(responsePart);
                    responsePart.addAttribute(ATTRIBUTE_NAME,
                                              "part1",
                                              null);

                    responsePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
                                              namespacePrefix + COLON_SEPARATOR
                                                      + jmethod.getSimpleName() + RESPONSE,
                                              null);
                }
            }
        }
View Full Code Here

    /**
     * Generate the porttypes
     */
    private void generatePortType(OMFactory fac, OMElement defintions) {
        JMethod jmethod = null;
        OMElement operation = null;
        OMElement message = null;
        OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME,
                                                 wsdl);
        defintions.addChild(portType);
        portType.addAttribute(ATTRIBUTE_NAME,
                              generationParams.getServiceName() + PORT_TYPE_SUFFIX,
                              null);
        // adding message refs
        for (int i = 0; i < method.length; i++) {
            jmethod = method[i];

            if (jmethod.isPublic()) {
                operation = fac.createOMElement(OPERATION_LOCAL_NAME,
                                                wsdl);
                portType.addChild(operation);
                operation.addAttribute(ATTRIBUTE_NAME,
                                       jmethod.getSimpleName(),
                                       null);

                message = fac.createOMElement(IN_PUT_LOCAL_NAME,
                                              wsdl);
                message.addAttribute(MESSAGE_LOCAL_NAME,
                                     tns.getPrefix() + COLON_SEPARATOR + jmethod.getSimpleName()
                                             + MESSAGE_SUFFIX,
                                     null);
                operation.addChild(message);

                if (!jmethod.getReturnType().isVoidType()) {
                    message = fac.createOMElement(OUT_PUT_LOCAL_NAME,
                                                  wsdl);
                    message.addAttribute(MESSAGE_LOCAL_NAME,
                                         tns.getPrefix() + COLON_SEPARATOR
                                                 + jmethod.getSimpleName() + RESPONSE_MESSAGE,
                                         null);
                    operation.addChild(message);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.codehaus.jam.JMethod

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.