com.sun.tools.internal.ws.resources.WebserviceapMessages Java Examples

The following examples show how to use com.sun.tools.internal.ws.resources.WebserviceapMessages. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebServiceVisitor.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected boolean hasWebMethods(TypeElement element) {
    if (element.getQualifiedName().toString().equals(Object.class.getName()))
        return false;
    WebMethod webMethod;
    for (ExecutableElement method : ElementFilter.methodsIn(element.getEnclosedElements())) {
        webMethod = method.getAnnotation(WebMethod.class);
        if (webMethod != null) {
            if (webMethod.exclude()) {
                if (webMethod.operationName().length() > 0)
                    builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE(
                            "operationName", element.getQualifiedName(), method.toString()), method);
                if (webMethod.action().length() > 0)
                    builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE(
                            "action", element.getQualifiedName(), method.toString()), method);
            } else {
                return true;
            }
        }
    }
    return false;//hasWebMethods(d.getSuperclass().getDeclaration());
}
 
Example #2
Source File: WebServiceVisitor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected boolean hasWebMethods(TypeElement element) {
    if (element.getQualifiedName().toString().equals(Object.class.getName()))
        return false;
    WebMethod webMethod;
    for (ExecutableElement method : ElementFilter.methodsIn(element.getEnclosedElements())) {
        webMethod = method.getAnnotation(WebMethod.class);
        if (webMethod != null) {
            if (webMethod.exclude()) {
                if (webMethod.operationName().length() > 0)
                    builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE(
                            "operationName", element.getQualifiedName(), method.toString()), method);
                if (webMethod.action().length() > 0)
                    builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE(
                            "action", element.getQualifiedName(), method.toString()), method);
            } else {
                return true;
            }
        }
    }
    return false;//hasWebMethods(d.getSuperclass().getDeclaration());
}
 
Example #3
Source File: WebServiceVisitor.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected boolean classImplementsSei(TypeElement classElement, TypeElement interfaceElement) {
    for (TypeMirror interfaceType : classElement.getInterfaces()) {
        if (((DeclaredType) interfaceType).asElement().equals(interfaceElement))
            return true;
    }
    List<ExecutableElement> classMethods = getClassMethods(classElement);
    boolean implementsMethod;
    for (ExecutableElement interfaceMethod : ElementFilter.methodsIn(interfaceElement.getEnclosedElements())) {
        implementsMethod = false;
        for (ExecutableElement classMethod : classMethods) {
            if (sameMethod(interfaceMethod, classMethod)) {
                implementsMethod = true;
                classMethods.remove(classMethod);
                break;
            }
        }
        if (!implementsMethod) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_NOT_IMPLEMENTED(interfaceElement.getSimpleName(), classElement.getSimpleName(), interfaceMethod), interfaceMethod);
            return false;
        }
    }
    return true;
}
 
Example #4
Source File: WebServiceVisitor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected boolean shouldProcessMethod(ExecutableElement method, WebMethod webMethod) {
    builder.log("should process method: " + method.getSimpleName() + " hasWebMethods: " + hasWebMethods + " ");
    /*
    Fix for https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577
    if (hasWebMethods && webMethod == null) {
        builder.log("webMethod == null");
        return false;
    }
    */
    Collection<Modifier> modifiers = method.getModifiers();
    boolean staticFinal = modifiers.contains(Modifier.STATIC) || modifiers.contains(Modifier.FINAL);
    if (staticFinal) {
        if (webMethod != null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_STATIC_OR_FINAL(method.getEnclosingElement(),
                    method), method);
        }
        return false;
    }
    boolean result = (endpointReferencesInterface ||
            method.getEnclosingElement().equals(typeElement) ||
            (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("endpointReferencesInterface: " + endpointReferencesInterface);
    builder.log("declaring class has WebService: " + (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("returning: " + result);
    return result;
}
 
Example #5
Source File: WebServiceVisitor.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected boolean shouldProcessMethod(ExecutableElement method, WebMethod webMethod) {
    builder.log("should process method: " + method.getSimpleName() + " hasWebMethods: " + hasWebMethods + " ");
    /*
    Fix for https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577
    if (hasWebMethods && webMethod == null) {
        builder.log("webMethod == null");
        return false;
    }
    */
    Collection<Modifier> modifiers = method.getModifiers();
    boolean staticFinal = modifiers.contains(Modifier.STATIC) || modifiers.contains(Modifier.FINAL);
    if (staticFinal) {
        if (webMethod != null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_STATIC_OR_FINAL(method.getEnclosingElement(),
                    method), method);
        }
        return false;
    }
    boolean result = (endpointReferencesInterface ||
            method.getEnclosingElement().equals(typeElement) ||
            (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("endpointReferencesInterface: " + endpointReferencesInterface);
    builder.log("declaring class has WebService: " + (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("returning: " + result);
    return result;
}
 
Example #6
Source File: WebServiceVisitor.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected boolean hasWebMethods(TypeElement element) {
    if (element.getQualifiedName().toString().equals(Object.class.getName()))
        return false;
    WebMethod webMethod;
    for (ExecutableElement method : ElementFilter.methodsIn(element.getEnclosedElements())) {
        webMethod = method.getAnnotation(WebMethod.class);
        if (webMethod != null) {
            if (webMethod.exclude()) {
                if (webMethod.operationName().length() > 0)
                    builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE(
                            "operationName", element.getQualifiedName(), method.toString()), method);
                if (webMethod.action().length() > 0)
                    builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE(
                            "action", element.getQualifiedName(), method.toString()), method);
            } else {
                return true;
            }
        }
    }
    return false;//hasWebMethods(d.getSuperclass().getDeclaration());
}
 
Example #7
Source File: WebServiceVisitor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected boolean classImplementsSei(TypeElement classElement, TypeElement interfaceElement) {
    for (TypeMirror interfaceType : classElement.getInterfaces()) {
        if (((DeclaredType) interfaceType).asElement().equals(interfaceElement))
            return true;
    }
    List<ExecutableElement> classMethods = getClassMethods(classElement);
    boolean implementsMethod;
    for (ExecutableElement interfaceMethod : ElementFilter.methodsIn(interfaceElement.getEnclosedElements())) {
        implementsMethod = false;
        for (ExecutableElement classMethod : classMethods) {
            if (sameMethod(interfaceMethod, classMethod)) {
                implementsMethod = true;
                classMethods.remove(classMethod);
                break;
            }
        }
        if (!implementsMethod) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_NOT_IMPLEMENTED(interfaceElement.getSimpleName(), classElement.getSimpleName(), interfaceMethod), interfaceMethod);
            return false;
        }
    }
    return true;
}
 
Example #8
Source File: WebServiceWrapperGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private boolean generateExceptionBeans(ExecutableElement method) {
    String beanPackage = packageName + PD_JAXWS_PACKAGE_PD.getValue();
    if (packageName.length() == 0)
        beanPackage = JAXWS_PACKAGE_PD.getValue();
    boolean beanGenerated = false;
    for (TypeMirror thrownType : method.getThrownTypes()) {
        TypeElement typeDecl = (TypeElement) ((DeclaredType) thrownType).asElement();
        if (typeDecl == null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(
                    thrownType.toString(), context.getRound()));
            return false;
        }
        boolean tmp = generateExceptionBean(typeDecl, beanPackage);
        beanGenerated = beanGenerated || tmp;
    }
    return beanGenerated;
}
 
Example #9
Source File: WebServiceWrapperGenerator.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private boolean generateExceptionBeans(ExecutableElement method) {
    String beanPackage = packageName + PD_JAXWS_PACKAGE_PD.getValue();
    if (packageName.length() == 0)
        beanPackage = JAXWS_PACKAGE_PD.getValue();
    boolean beanGenerated = false;
    for (TypeMirror thrownType : method.getThrownTypes()) {
        TypeElement typeDecl = (TypeElement) ((DeclaredType) thrownType).asElement();
        if (typeDecl == null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(
                    thrownType.toString(), context.getRound()));
            return false;
        }
        boolean tmp = generateExceptionBean(typeDecl, beanPackage);
        beanGenerated = beanGenerated || tmp;
    }
    return beanGenerated;
}
 
Example #10
Source File: WebServiceWrapperGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private boolean generateExceptionBeans(ExecutableElement method) {
    String beanPackage = packageName + PD_JAXWS_PACKAGE_PD.getValue();
    if (packageName.length() == 0)
        beanPackage = JAXWS_PACKAGE_PD.getValue();
    boolean beanGenerated = false;
    for (TypeMirror thrownType : method.getThrownTypes()) {
        TypeElement typeDecl = (TypeElement) ((DeclaredType) thrownType).asElement();
        if (typeDecl == null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(
                    thrownType.toString(), context.getRound()));
            return false;
        }
        boolean tmp = generateExceptionBean(typeDecl, beanPackage);
        beanGenerated = beanGenerated || tmp;
    }
    return beanGenerated;
}
 
Example #11
Source File: WebServiceVisitor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected boolean hasWebMethods(TypeElement element) {
    if (element.getQualifiedName().toString().equals(Object.class.getName()))
        return false;
    WebMethod webMethod;
    for (ExecutableElement method : ElementFilter.methodsIn(element.getEnclosedElements())) {
        webMethod = method.getAnnotation(WebMethod.class);
        if (webMethod != null) {
            if (webMethod.exclude()) {
                if (webMethod.operationName().length() > 0)
                    builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE(
                            "operationName", element.getQualifiedName(), method.toString()), method);
                if (webMethod.action().length() > 0)
                    builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE(
                            "action", element.getQualifiedName(), method.toString()), method);
            } else {
                return true;
            }
        }
    }
    return false;//hasWebMethods(d.getSuperclass().getDeclaration());
}
 
Example #12
Source File: WebServiceVisitor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected boolean shouldProcessMethod(ExecutableElement method, WebMethod webMethod) {
    builder.log("should process method: " + method.getSimpleName() + " hasWebMethods: " + hasWebMethods + " ");
    /*
    Fix for https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577
    if (hasWebMethods && webMethod == null) {
        builder.log("webMethod == null");
        return false;
    }
    */
    Collection<Modifier> modifiers = method.getModifiers();
    boolean staticFinal = modifiers.contains(Modifier.STATIC) || modifiers.contains(Modifier.FINAL);
    if (staticFinal) {
        if (webMethod != null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_STATIC_OR_FINAL(method.getEnclosingElement(),
                    method), method);
        }
        return false;
    }
    boolean result = (endpointReferencesInterface ||
            method.getEnclosingElement().equals(typeElement) ||
            (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("endpointReferencesInterface: " + endpointReferencesInterface);
    builder.log("declaring class has WebService: " + (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("returning: " + result);
    return result;
}
 
Example #13
Source File: WebServiceVisitor.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected boolean classImplementsSei(TypeElement classElement, TypeElement interfaceElement) {
    for (TypeMirror interfaceType : classElement.getInterfaces()) {
        if (((DeclaredType) interfaceType).asElement().equals(interfaceElement))
            return true;
    }
    List<ExecutableElement> classMethods = getClassMethods(classElement);
    boolean implementsMethod;
    for (ExecutableElement interfaceMethod : ElementFilter.methodsIn(interfaceElement.getEnclosedElements())) {
        implementsMethod = false;
        for (ExecutableElement classMethod : classMethods) {
            if (sameMethod(interfaceMethod, classMethod)) {
                implementsMethod = true;
                classMethods.remove(classMethod);
                break;
            }
        }
        if (!implementsMethod) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_NOT_IMPLEMENTED(interfaceElement.getSimpleName(), classElement.getSimpleName(), interfaceMethod), interfaceMethod);
            return false;
        }
    }
    return true;
}
 
Example #14
Source File: WebServiceVisitor.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected boolean shouldProcessMethod(ExecutableElement method, WebMethod webMethod) {
    builder.log("should process method: " + method.getSimpleName() + " hasWebMethods: " + hasWebMethods + " ");
    /*
    Fix for https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577
    if (hasWebMethods && webMethod == null) {
        builder.log("webMethod == null");
        return false;
    }
    */
    Collection<Modifier> modifiers = method.getModifiers();
    boolean staticFinal = modifiers.contains(Modifier.STATIC) || modifiers.contains(Modifier.FINAL);
    if (staticFinal) {
        if (webMethod != null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_STATIC_OR_FINAL(method.getEnclosingElement(),
                    method), method);
        }
        return false;
    }
    boolean result = (endpointReferencesInterface ||
            method.getEnclosingElement().equals(typeElement) ||
            (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("endpointReferencesInterface: " + endpointReferencesInterface);
    builder.log("declaring class has WebService: " + (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("returning: " + result);
    return result;
}
 
Example #15
Source File: WebServiceVisitor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected boolean classImplementsSei(TypeElement classElement, TypeElement interfaceElement) {
    for (TypeMirror interfaceType : classElement.getInterfaces()) {
        if (((DeclaredType) interfaceType).asElement().equals(interfaceElement))
            return true;
    }
    List<ExecutableElement> classMethods = getClassMethods(classElement);
    boolean implementsMethod;
    for (ExecutableElement interfaceMethod : ElementFilter.methodsIn(interfaceElement.getEnclosedElements())) {
        implementsMethod = false;
        for (ExecutableElement classMethod : classMethods) {
            if (sameMethod(interfaceMethod, classMethod)) {
                implementsMethod = true;
                classMethods.remove(classMethod);
                break;
            }
        }
        if (!implementsMethod) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_NOT_IMPLEMENTED(interfaceElement.getSimpleName(), classElement.getSimpleName(), interfaceMethod), interfaceMethod);
            return false;
        }
    }
    return true;
}
 
Example #16
Source File: WebServiceVisitor.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected boolean shouldProcessMethod(ExecutableElement method, WebMethod webMethod) {
    builder.log("should process method: " + method.getSimpleName() + " hasWebMethods: " + hasWebMethods + " ");
    /*
    Fix for https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577
    if (hasWebMethods && webMethod == null) {
        builder.log("webMethod == null");
        return false;
    }
    */
    Collection<Modifier> modifiers = method.getModifiers();
    boolean staticFinal = modifiers.contains(Modifier.STATIC) || modifiers.contains(Modifier.FINAL);
    if (staticFinal) {
        if (webMethod != null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_STATIC_OR_FINAL(method.getEnclosingElement(),
                    method), method);
        }
        return false;
    }
    boolean result = (endpointReferencesInterface ||
            method.getEnclosingElement().equals(typeElement) ||
            (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("endpointReferencesInterface: " + endpointReferencesInterface);
    builder.log("declaring class has WebService: " + (method.getEnclosingElement().getAnnotation(WebService.class) != null));
    builder.log("returning: " + result);
    return result;
}
 
Example #17
Source File: WebServiceWrapperGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private boolean generateExceptionBeans(ExecutableElement method) {
    String beanPackage = packageName + PD_JAXWS_PACKAGE_PD.getValue();
    if (packageName.length() == 0)
        beanPackage = JAXWS_PACKAGE_PD.getValue();
    boolean beanGenerated = false;
    for (TypeMirror thrownType : method.getThrownTypes()) {
        TypeElement typeDecl = (TypeElement) ((DeclaredType) thrownType).asElement();
        if (typeDecl == null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(
                    thrownType.toString(), context.getRound()));
            return false;
        }
        boolean tmp = generateExceptionBean(typeDecl, beanPackage);
        beanGenerated = beanGenerated || tmp;
    }
    return beanGenerated;
}
 
Example #18
Source File: WebServiceVisitor.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected boolean classImplementsSei(TypeElement classElement, TypeElement interfaceElement) {
    for (TypeMirror interfaceType : classElement.getInterfaces()) {
        if (((DeclaredType) interfaceType).asElement().equals(interfaceElement))
            return true;
    }
    List<ExecutableElement> classMethods = getClassMethods(classElement);
    boolean implementsMethod;
    for (ExecutableElement interfaceMethod : ElementFilter.methodsIn(interfaceElement.getEnclosedElements())) {
        implementsMethod = false;
        for (ExecutableElement classMethod : classMethods) {
            if (sameMethod(interfaceMethod, classMethod)) {
                implementsMethod = true;
                classMethods.remove(classMethod);
                break;
            }
        }
        if (!implementsMethod) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_NOT_IMPLEMENTED(interfaceElement.getSimpleName(), classElement.getSimpleName(), interfaceMethod), interfaceMethod);
            return false;
        }
    }
    return true;
}
 
Example #19
Source File: WebServiceVisitor.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected void verifySeiAnnotations(WebService webService, TypeElement d) {
    if (webService.endpointInterface().length() > 0) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_ENDPOINTINTERFACE_ON_INTERFACE(
                d.getQualifiedName(), webService.endpointInterface()), d);
    }
    if (webService.serviceName().length() > 0) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT(
                "serviceName", d.getQualifiedName()), d);
    }
    if (webService.portName().length() > 0) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT(
                "portName", d.getQualifiedName()), d);
    }
}
 
Example #20
Source File: WebServiceVisitor.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected boolean isLegalSei(TypeElement interfaceElement) {
    for (VariableElement field : ElementFilter.fieldsIn(interfaceElement.getEnclosedElements()))
        if (field.getConstantValue() != null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_SEI_CANNOT_CONTAIN_CONSTANT_VALUES(
                    interfaceElement.getQualifiedName(), field.getSimpleName()));
            return false;
        }
    return methodsAreLegal(interfaceElement);
}
 
Example #21
Source File: WebServiceVisitor.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected void preProcessWebService(WebService webService, TypeElement element) {
    processedMethods = new HashSet<String>();
    seiContext = context.getSeiContext(element);
    String targetNamespace = null;
    if (webService != null)
        targetNamespace = webService.targetNamespace();
    PackageElement packageElement = builder.getProcessingEnvironment().getElementUtils().getPackageOf(element);
    if (targetNamespace == null || targetNamespace.length() == 0) {
        String packageName = packageElement.getQualifiedName().toString();
        if (packageName == null || packageName.length() == 0) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE(
                    element.getQualifiedName()), element);
        }
        targetNamespace = RuntimeModeler.getNamespace(packageName);
    }
    seiContext.setNamespaceUri(targetNamespace);
    if (serviceImplName == null)
        serviceImplName = seiContext.getSeiImplName();
    if (serviceImplName != null) {
        seiContext.setSeiImplName(serviceImplName);
        context.addSeiContext(serviceImplName, seiContext);
    }
    portName = ClassNameInfo.getName(element.getSimpleName().toString().replace('$', '_'));
    packageName = packageElement.getQualifiedName();
    portName = webService != null && webService.name() != null && webService.name().length() > 0 ?
            webService.name() : portName;
    serviceName = ClassNameInfo.getName(element.getQualifiedName().toString()) + WebServiceConstants.SERVICE.getValue();
    serviceName = webService != null && webService.serviceName() != null && webService.serviceName().length() > 0 ?
            webService.serviceName() : serviceName;
    wsdlNamespace = seiContext.getNamespaceUri();
    typeNamespace = wsdlNamespace;

    SOAPBinding soapBinding = element.getAnnotation(SOAPBinding.class);
    if (soapBinding != null) {
        pushedSoapBinding = pushSoapBinding(soapBinding, element, element);
    } else if (element.equals(typeElement)) {
        pushedSoapBinding = pushSoapBinding(new MySoapBinding(), element, element);
    }
}
 
Example #22
Source File: WebServiceVisitor.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected void checkForInvalidSeiAnnotation(TypeElement element, Class annotationClass) {
    Object annotation = element.getAnnotation(annotationClass);
    if (annotation != null) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION(
                annotationClass.getName(), element.getQualifiedName()), element);
    }
}
 
Example #23
Source File: WebServiceVisitor.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected boolean isLegalParameter(VariableElement param,
                                   ExecutableElement method,
                                   TypeElement typeElement,
                                   int paramIndex) {
    if (!isLegalType(param.asType())) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_PARAMETER_TYPES_CANNOT_IMPLEMENT_REMOTE(typeElement.getQualifiedName(),
                method.getSimpleName(),
                param.getSimpleName(),
                param.asType().toString()), param);
        return false;
    }
    TypeMirror holderType;
    holderType = builder.getHolderValueType(param.asType());
    WebParam webParam = param.getAnnotation(WebParam.class);
    WebParam.Mode mode = null;
    if (webParam != null)
        mode = webParam.mode();

    if (holderType != null) {
        if (mode != null && mode == WebParam.Mode.IN)
            builder.processError(WebserviceapMessages.WEBSERVICEAP_HOLDER_PARAMETERS_MUST_NOT_BE_IN_ONLY(typeElement.getQualifiedName(), method.toString(), paramIndex), param);
    } else if (mode != null && mode != WebParam.Mode.IN) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_NON_IN_PARAMETERS_MUST_BE_HOLDER(typeElement.getQualifiedName(), method.toString(), paramIndex), param);
    }

    return true;
}
 
Example #24
Source File: WebServiceVisitor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected boolean isLegalSei(TypeElement interfaceElement) {
    for (VariableElement field : ElementFilter.fieldsIn(interfaceElement.getEnclosedElements()))
        if (field.getConstantValue() != null) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_SEI_CANNOT_CONTAIN_CONSTANT_VALUES(
                    interfaceElement.getQualifiedName(), field.getSimpleName()));
            return false;
        }
    return methodsAreLegal(interfaceElement);
}
 
Example #25
Source File: WebServiceVisitor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected void checkForInvalidSeiAnnotation(TypeElement element, Class annotationClass) {
    Object annotation = element.getAnnotation(annotationClass);
    if (annotation != null) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION(
                annotationClass.getName(), element.getQualifiedName()), element);
    }
}
 
Example #26
Source File: WebServiceVisitor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected void verifySeiAnnotations(WebService webService, TypeElement d) {
    if (webService.endpointInterface().length() > 0) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_ENDPOINTINTERFACE_ON_INTERFACE(
                d.getQualifiedName(), webService.endpointInterface()), d);
    }
    if (webService.serviceName().length() > 0) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT(
                "serviceName", d.getQualifiedName()), d);
    }
    if (webService.portName().length() > 0) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT(
                "portName", d.getQualifiedName()), d);
    }
}
 
Example #27
Source File: WebServiceAp.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (context.getRound() != 1) {
        return true;
    }
    context.incrementRound();
    WebService webService;
    WebServiceProvider webServiceProvider;
    WebServiceVisitor webServiceVisitor = new WebServiceWrapperGenerator(this, context);
    boolean processedEndpoint = false;
    Collection<TypeElement> classes = new ArrayList<TypeElement>();
    filterClasses(classes, roundEnv.getRootElements());
    for (TypeElement element : classes) {
        webServiceProvider = element.getAnnotation(WebServiceProvider.class);
        webService = element.getAnnotation(WebService.class);
        if (webServiceProvider != null) {
            if (webService != null) {
                processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(element.getQualifiedName()));
            }
            processedEndpoint = true;
        }

        if (webService == null) {
            continue;
        }

        element.accept(webServiceVisitor, null);
        processedEndpoint = true;
    }
    if (!processedEndpoint) {
        if (isCommandLineInvocation) {
            if (!ignoreNoWebServiceFoundWarning) {
                processWarning(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
            }
        } else {
            processError(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
        }
    }
    return true;
}
 
Example #28
Source File: WebServiceVisitor.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected boolean isLegalType(TypeMirror type) {
    if (!(type != null && type.getKind().equals(TypeKind.DECLARED)))
        return true;
    TypeElement tE = (TypeElement) ((DeclaredType) type).asElement();
    if (tE == null) {
        // can be null, if this type's declaration is unknown. This may be the result of a processing error, such as a missing class file.
        builder.processError(WebserviceapMessages.WEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(type.toString(), context.getRound()));
    }
    return !builder.isRemote(tE);
}
 
Example #29
Source File: WebServiceVisitor.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected boolean isValidOneWayMethod(ExecutableElement method, TypeElement typeElement) {
    boolean valid = true;
    if (!(method.getReturnType().accept(NO_TYPE_VISITOR, null))) {
        // this is an error, cannot be OneWay and have a return type
        builder.processError(WebserviceapMessages.WEBSERVICEAP_ONEWAY_OPERATION_CANNOT_HAVE_RETURN_TYPE(typeElement.getQualifiedName(), method.toString()), method);
        valid = false;
    }
    VariableElement outParam = getOutParameter(method);
    if (outParam != null) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_ONEWAY_AND_OUT(typeElement.getQualifiedName(), method.toString()), outParam);
        valid = false;
    }
    if (!isDocLitWrapped() && soapStyle.equals(SOAPStyle.DOCUMENT)) {
        int inCnt = getModeParameterCount(method, WebParam.Mode.IN);
        if (inCnt != 1) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_ONEWAY_AND_NOT_ONE_IN(typeElement.getQualifiedName(), method.toString()), method);
            valid = false;
        }
    }
    for (TypeMirror thrownType : method.getThrownTypes()) {
        TypeElement thrownElement = (TypeElement) ((DeclaredType) thrownType).asElement();
        if (builder.isServiceException(thrownType)) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_ONEWAY_OPERATION_CANNOT_DECLARE_EXCEPTIONS(
                    typeElement.getQualifiedName(), method.toString(), thrownElement.getQualifiedName()), method);
            valid = false;
        }
    }
    return valid;
}
 
Example #30
Source File: WebServiceVisitor.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected boolean isLegalParameter(VariableElement param,
                                   ExecutableElement method,
                                   TypeElement typeElement,
                                   int paramIndex) {
    if (!isLegalType(param.asType())) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_PARAMETER_TYPES_CANNOT_IMPLEMENT_REMOTE(typeElement.getQualifiedName(),
                method.getSimpleName(),
                param.getSimpleName(),
                param.asType().toString()), param);
        return false;
    }
    TypeMirror holderType;
    holderType = builder.getHolderValueType(param.asType());
    WebParam webParam = param.getAnnotation(WebParam.class);
    WebParam.Mode mode = null;
    if (webParam != null)
        mode = webParam.mode();

    if (holderType != null) {
        if (mode != null && mode == WebParam.Mode.IN)
            builder.processError(WebserviceapMessages.WEBSERVICEAP_HOLDER_PARAMETERS_MUST_NOT_BE_IN_ONLY(typeElement.getQualifiedName(), method.toString(), paramIndex), param);
    } else if (mode != null && mode != WebParam.Mode.IN) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_NON_IN_PARAMETERS_MUST_BE_HOLDER(typeElement.getQualifiedName(), method.toString(), paramIndex), param);
    }

    return true;
}