com.sun.tools.internal.ws.util.ClassNameInfo Java Examples

The following examples show how to use com.sun.tools.internal.ws.util.ClassNameInfo. 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: Names.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static String getPortName(Port port) {
    String javaPortName =
        (String) port.getProperty(ModelProperties.PROPERTY_JAVA_PORT_NAME);
    if (javaPortName != null) {
        return javaPortName;
    } else {
        QName portName =
            (QName) port.getProperty(
                ModelProperties.PROPERTY_WSDL_PORT_NAME);
        if (portName != null) {
            return portName.getLocalPart();
        } else {
            String name = stripQualifier(port.getJavaInterface().getName());
            return ClassNameInfo.replaceInnerClassSym(name);
        }
    }
}
 
Example #2
Source File: Names.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static String getPortName(Port port) {
    String javaPortName =
        (String) port.getProperty(ModelProperties.PROPERTY_JAVA_PORT_NAME);
    if (javaPortName != null) {
        return javaPortName;
    } else {
        QName portName =
            (QName) port.getProperty(
                ModelProperties.PROPERTY_WSDL_PORT_NAME);
        if (portName != null) {
            return portName.getLocalPart();
        } else {
            String name = stripQualifier(port.getJavaInterface().getName());
            return ClassNameInfo.replaceInnerClassSym(name);
        }
    }
}
 
Example #3
Source File: Names.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static String getPortName(Port port) {
    String javaPortName =
        (String) port.getProperty(ModelProperties.PROPERTY_JAVA_PORT_NAME);
    if (javaPortName != null) {
        return javaPortName;
    } else {
        QName portName =
            (QName) port.getProperty(
                ModelProperties.PROPERTY_WSDL_PORT_NAME);
        if (portName != null) {
            return portName.getLocalPart();
        } else {
            String name = stripQualifier(port.getJavaInterface().getName());
            return ClassNameInfo.replaceInnerClassSym(name);
        }
    }
}
 
Example #4
Source File: Names.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static String getPortName(Port port) {
    String javaPortName =
        (String) port.getProperty(ModelProperties.PROPERTY_JAVA_PORT_NAME);
    if (javaPortName != null) {
        return javaPortName;
    } else {
        QName portName =
            (QName) port.getProperty(
                ModelProperties.PROPERTY_WSDL_PORT_NAME);
        if (portName != null) {
            return portName.getLocalPart();
        } else {
            String name = stripQualifier(port.getJavaInterface().getName());
            return ClassNameInfo.replaceInnerClassSym(name);
        }
    }
}
 
Example #5
Source File: Names.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static String getPortName(Port port) {
    String javaPortName =
        (String) port.getProperty(ModelProperties.PROPERTY_JAVA_PORT_NAME);
    if (javaPortName != null) {
        return javaPortName;
    } else {
        QName portName =
            (QName) port.getProperty(
                ModelProperties.PROPERTY_WSDL_PORT_NAME);
        if (portName != null) {
            return portName.getLocalPart();
        } else {
            String name = stripQualifier(port.getJavaInterface().getName());
            return ClassNameInfo.replaceInnerClassSym(name);
        }
    }
}
 
Example #6
Source File: Names.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static String getPortName(Port port) {
    String javaPortName =
        (String) port.getProperty(ModelProperties.PROPERTY_JAVA_PORT_NAME);
    if (javaPortName != null) {
        return javaPortName;
    } else {
        QName portName =
            (QName) port.getProperty(
                ModelProperties.PROPERTY_WSDL_PORT_NAME);
        if (portName != null) {
            return portName.getLocalPart();
        } else {
            String name = stripQualifier(port.getJavaInterface().getName());
            return ClassNameInfo.replaceInnerClassSym(name);
        }
    }
}
 
Example #7
Source File: Names.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static String getPortName(Port port) {
    String javaPortName =
        (String) port.getProperty(ModelProperties.PROPERTY_JAVA_PORT_NAME);
    if (javaPortName != null) {
        return javaPortName;
    } else {
        QName portName =
            (QName) port.getProperty(
                ModelProperties.PROPERTY_WSDL_PORT_NAME);
        if (portName != null) {
            return portName.getLocalPart();
        } else {
            String name = stripQualifier(port.getJavaInterface().getName());
            return ClassNameInfo.replaceInnerClassSym(name);
        }
    }
}
 
Example #8
Source File: Names.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static String getPortName(Port port) {
    String javaPortName =
        (String) port.getProperty(ModelProperties.PROPERTY_JAVA_PORT_NAME);
    if (javaPortName != null) {
        return javaPortName;
    } else {
        QName portName =
            (QName) port.getProperty(
                ModelProperties.PROPERTY_WSDL_PORT_NAME);
        if (portName != null) {
            return portName.getLocalPart();
        } else {
            String name = stripQualifier(port.getJavaInterface().getName());
            return ClassNameInfo.replaceInnerClassSym(name);
        }
    }
}
 
Example #9
Source File: ModelerUtils.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static List<Parameter> createRpcLitParameters(Message message, Block block, S2JJAXBModel jaxbModel, ErrorReceiverFilter errReceiver){
    RpcLitStructure rpcStruct = (RpcLitStructure)block.getType();

    List<Parameter> parameters = new ArrayList<Parameter>();
    for(MessagePart part : message.getParts()){
        if(!ModelerUtils.isBoundToSOAPBody(part))
            continue;
        QName name = part.getDescriptor();
        TypeAndAnnotation typeAndAnn = jaxbModel.getJavaType(name);
        if(typeAndAnn == null){
            String msgQName = "{"+message.getDefining().getTargetNamespaceURI()+"}"+message.getName();
            errReceiver.error(part.getLocator(), ModelerMessages.WSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(name.toString(),
                    part.getName(), msgQName));
            throw new AbortException();
        }
        String type = typeAndAnn.getTypeClass().fullName();
        type = ClassNameInfo.getGenericClass(type);
        RpcLitMember param = new RpcLitMember(new QName("", part.getName()), type);
        JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAndAnn));
        param.setJavaType(javaType);
        rpcStruct.addRpcLitMember(param);
        Parameter parameter = ModelerUtils.createParameter(part.getName(), param, block);
        parameter.setEmbedded(true);
        parameters.add(parameter);
    }
    return parameters;
}
 
Example #10
Source File: ModelerUtils.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static List<Parameter> createRpcLitParameters(Message message, Block block, S2JJAXBModel jaxbModel, ErrorReceiverFilter errReceiver){
    RpcLitStructure rpcStruct = (RpcLitStructure)block.getType();

    List<Parameter> parameters = new ArrayList<Parameter>();
    for(MessagePart part : message.getParts()){
        if(!ModelerUtils.isBoundToSOAPBody(part))
            continue;
        QName name = part.getDescriptor();
        TypeAndAnnotation typeAndAnn = jaxbModel.getJavaType(name);
        if(typeAndAnn == null){
            String msgQName = "{"+message.getDefining().getTargetNamespaceURI()+"}"+message.getName();
            errReceiver.error(part.getLocator(), ModelerMessages.WSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(name.toString(),
                    part.getName(), msgQName));
            throw new AbortException();
        }
        String type = typeAndAnn.getTypeClass().fullName();
        type = ClassNameInfo.getGenericClass(type);
        RpcLitMember param = new RpcLitMember(new QName("", part.getName()), type);
        JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAndAnn));
        param.setJavaType(javaType);
        rpcStruct.addRpcLitMember(param);
        Parameter parameter = ModelerUtils.createParameter(part.getName(), param, block);
        parameter.setEmbedded(true);
        parameters.add(parameter);
    }
    return parameters;
}
 
Example #11
Source File: WebServiceVisitor.java    From openjdk-jdk8u-backup 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 #12
Source File: ModelerUtils.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static List<Parameter> createRpcLitParameters(Message message, Block block, S2JJAXBModel jaxbModel, ErrorReceiverFilter errReceiver){
    RpcLitStructure rpcStruct = (RpcLitStructure)block.getType();

    List<Parameter> parameters = new ArrayList<Parameter>();
    for(MessagePart part : message.getParts()){
        if(!ModelerUtils.isBoundToSOAPBody(part))
            continue;
        QName name = part.getDescriptor();
        TypeAndAnnotation typeAndAnn = jaxbModel.getJavaType(name);
        if(typeAndAnn == null){
            String msgQName = "{"+message.getDefining().getTargetNamespaceURI()+"}"+message.getName();
            errReceiver.error(part.getLocator(), ModelerMessages.WSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(name.toString(),
                    part.getName(), msgQName));
            throw new AbortException();
        }
        String type = typeAndAnn.getTypeClass().fullName();
        type = ClassNameInfo.getGenericClass(type);
        RpcLitMember param = new RpcLitMember(new QName("", part.getName()), type);
        JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAndAnn));
        param.setJavaType(javaType);
        rpcStruct.addRpcLitMember(param);
        Parameter parameter = ModelerUtils.createParameter(part.getName(), param, block);
        parameter.setEmbedded(true);
        parameters.add(parameter);
    }
    return parameters;
}
 
Example #13
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 #14
Source File: ModelerUtils.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static List<Parameter> createRpcLitParameters(Message message, Block block, S2JJAXBModel jaxbModel, ErrorReceiverFilter errReceiver){
    RpcLitStructure rpcStruct = (RpcLitStructure)block.getType();

    List<Parameter> parameters = new ArrayList<Parameter>();
    for(MessagePart part : message.getParts()){
        if(!ModelerUtils.isBoundToSOAPBody(part))
            continue;
        QName name = part.getDescriptor();
        TypeAndAnnotation typeAndAnn = jaxbModel.getJavaType(name);
        if(typeAndAnn == null){
            String msgQName = "{"+message.getDefining().getTargetNamespaceURI()+"}"+message.getName();
            errReceiver.error(part.getLocator(), ModelerMessages.WSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(name.toString(),
                    part.getName(), msgQName));
            throw new AbortException();
        }
        String type = typeAndAnn.getTypeClass().fullName();
        type = ClassNameInfo.getGenericClass(type);
        RpcLitMember param = new RpcLitMember(new QName("", part.getName()), type);
        JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAndAnn));
        param.setJavaType(javaType);
        rpcStruct.addRpcLitMember(param);
        Parameter parameter = ModelerUtils.createParameter(part.getName(), param, block);
        parameter.setEmbedded(true);
        parameters.add(parameter);
    }
    return parameters;
}
 
Example #15
Source File: WebServiceVisitor.java    From hottub 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 #16
Source File: ModelerUtils.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static List<Parameter> createRpcLitParameters(Message message, Block block, S2JJAXBModel jaxbModel, ErrorReceiverFilter errReceiver){
    RpcLitStructure rpcStruct = (RpcLitStructure)block.getType();

    List<Parameter> parameters = new ArrayList<Parameter>();
    for(MessagePart part : message.getParts()){
        if(!ModelerUtils.isBoundToSOAPBody(part))
            continue;
        QName name = part.getDescriptor();
        TypeAndAnnotation typeAndAnn = jaxbModel.getJavaType(name);
        if(typeAndAnn == null){
            String msgQName = "{"+message.getDefining().getTargetNamespaceURI()+"}"+message.getName();
            errReceiver.error(part.getLocator(), ModelerMessages.WSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(name.toString(),
                    part.getName(), msgQName));
            throw new AbortException();
        }
        String type = typeAndAnn.getTypeClass().fullName();
        type = ClassNameInfo.getGenericClass(type);
        RpcLitMember param = new RpcLitMember(new QName("", part.getName()), type);
        JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAndAnn));
        param.setJavaType(javaType);
        rpcStruct.addRpcLitMember(param);
        Parameter parameter = ModelerUtils.createParameter(part.getName(), param, block);
        parameter.setEmbedded(true);
        parameters.add(parameter);
    }
    return parameters;
}
 
Example #17
Source File: WebServiceVisitor.java    From openjdk-8-source 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 #18
Source File: ModelerUtils.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static List<Parameter> createRpcLitParameters(Message message, Block block, S2JJAXBModel jaxbModel, ErrorReceiverFilter errReceiver){
    RpcLitStructure rpcStruct = (RpcLitStructure)block.getType();

    List<Parameter> parameters = new ArrayList<Parameter>();
    for(MessagePart part : message.getParts()){
        if(!ModelerUtils.isBoundToSOAPBody(part))
            continue;
        QName name = part.getDescriptor();
        TypeAndAnnotation typeAndAnn = jaxbModel.getJavaType(name);
        if(typeAndAnn == null){
            String msgQName = "{"+message.getDefining().getTargetNamespaceURI()+"}"+message.getName();
            errReceiver.error(part.getLocator(), ModelerMessages.WSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(name.toString(),
                    part.getName(), msgQName));
            throw new AbortException();
        }
        String type = typeAndAnn.getTypeClass().fullName();
        type = ClassNameInfo.getGenericClass(type);
        RpcLitMember param = new RpcLitMember(new QName("", part.getName()), type);
        JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAndAnn));
        param.setJavaType(javaType);
        rpcStruct.addRpcLitMember(param);
        Parameter parameter = ModelerUtils.createParameter(part.getName(), param, block);
        parameter.setEmbedded(true);
        parameters.add(parameter);
    }
    return parameters;
}
 
Example #19
Source File: WebServiceVisitor.java    From openjdk-8 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 #20
Source File: WebServiceVisitor.java    From openjdk-jdk8u 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 #21
Source File: ModelerUtils.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static List<Parameter> createRpcLitParameters(Message message, Block block, S2JJAXBModel jaxbModel, ErrorReceiverFilter errReceiver){
    RpcLitStructure rpcStruct = (RpcLitStructure)block.getType();

    List<Parameter> parameters = new ArrayList<Parameter>();
    for(MessagePart part : message.getParts()){
        if(!ModelerUtils.isBoundToSOAPBody(part))
            continue;
        QName name = part.getDescriptor();
        TypeAndAnnotation typeAndAnn = jaxbModel.getJavaType(name);
        if(typeAndAnn == null){
            String msgQName = "{"+message.getDefining().getTargetNamespaceURI()+"}"+message.getName();
            errReceiver.error(part.getLocator(), ModelerMessages.WSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(name.toString(),
                    part.getName(), msgQName));
            throw new AbortException();
        }
        String type = typeAndAnn.getTypeClass().fullName();
        type = ClassNameInfo.getGenericClass(type);
        RpcLitMember param = new RpcLitMember(new QName("", part.getName()), type);
        JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAndAnn));
        param.setJavaType(javaType);
        rpcStruct.addRpcLitMember(param);
        Parameter parameter = ModelerUtils.createParameter(part.getName(), param, block);
        parameter.setEmbedded(true);
        parameters.add(parameter);
    }
    return parameters;
}
 
Example #22
Source File: WebServiceVisitor.java    From jdk8u60 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 #23
Source File: WebServiceVisitor.java    From TencentKona-8 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 #24
Source File: ModelerUtils.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static List<Parameter> createRpcLitParameters(Message message, Block block, S2JJAXBModel jaxbModel, ErrorReceiverFilter errReceiver){
    RpcLitStructure rpcStruct = (RpcLitStructure)block.getType();

    List<Parameter> parameters = new ArrayList<Parameter>();
    for(MessagePart part : message.getParts()){
        if(!ModelerUtils.isBoundToSOAPBody(part))
            continue;
        QName name = part.getDescriptor();
        TypeAndAnnotation typeAndAnn = jaxbModel.getJavaType(name);
        if(typeAndAnn == null){
            String msgQName = "{"+message.getDefining().getTargetNamespaceURI()+"}"+message.getName();
            errReceiver.error(part.getLocator(), ModelerMessages.WSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(name.toString(),
                    part.getName(), msgQName));
            throw new AbortException();
        }
        String type = typeAndAnn.getTypeClass().fullName();
        type = ClassNameInfo.getGenericClass(type);
        RpcLitMember param = new RpcLitMember(new QName("", part.getName()), type);
        JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAndAnn));
        param.setJavaType(javaType);
        rpcStruct.addRpcLitMember(param);
        Parameter parameter = ModelerUtils.createParameter(part.getName(), param, block);
        parameter.setEmbedded(true);
        parameters.add(parameter);
    }
    return parameters;
}
 
Example #25
Source File: JavaInterface.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public String getSimpleName() {
    return ClassNameInfo.getName(name);
}
 
Example #26
Source File: Names.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public static String getPackageName(String className) {
    String packageName = ClassNameInfo.getQualifier(className);
    return packageName != null ? packageName : "";
}
 
Example #27
Source File: Names.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public static String stripQualifier(String name) {
    return ClassNameInfo.getName(name);
}
 
Example #28
Source File: JavaInterface.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public String getSimpleName() {
    return ClassNameInfo.getName(name);
}
 
Example #29
Source File: Names.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static String getPackageName(String className) {
    String packageName = ClassNameInfo.getQualifier(className);
    return packageName != null ? packageName : "";
}
 
Example #30
Source File: WebServiceWrapperGenerator.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private boolean generateExceptionBean(TypeElement thrownDecl, String beanPackage) {
    if (!builder.isServiceException(thrownDecl.asType()))
        return false;

    String exceptionName = ClassNameInfo.getName(thrownDecl.getQualifiedName().toString());
    if (processedExceptions.contains(exceptionName))
        return false;
    processedExceptions.add(exceptionName);
    WebFault webFault = thrownDecl.getAnnotation(WebFault.class);
    String className = beanPackage+ exceptionName + BEAN.getValue();

    Collection<MemberInfo> members = ap_generator.collectExceptionBeanMembers(thrownDecl);
    boolean isWSDLException = isWSDLException(members, thrownDecl);
    String namespace = typeNamespace;
    String name = exceptionName;
    FaultInfo faultInfo;
    if (isWSDLException) {
        TypeMirror beanType =  getFaultInfoMember(members).getParamType();
        faultInfo = new FaultInfo(TypeMonikerFactory.getTypeMoniker(beanType), true);
        namespace = webFault.targetNamespace().length()>0 ?
                           webFault.targetNamespace() : namespace;
        name = webFault.name().length()>0 ?
                      webFault.name() : name;
        faultInfo.setElementName(new QName(namespace, name));
        seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder);
        return false;
    }
    if (webFault != null) {
        namespace = webFault.targetNamespace().length()>0 ?
                    webFault.targetNamespace() : namespace;
        name = webFault.name().length()>0 ?
               webFault.name() : name;
        className = webFault.faultBean().length()>0 ?
                    webFault.faultBean() : className;

    }
    JDefinedClass cls = getCMClass(className, CLASS);
    faultInfo = new FaultInfo(className, false);

    if (duplicateName(className)) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_EXCEPTION_BEAN_NAME_NOT_UNIQUE(
                typeElement.getQualifiedName(), thrownDecl.getQualifiedName()));
    }

    boolean canOverWriteBean = builder.canOverWriteClass(className);
    if (!canOverWriteBean) {
        builder.log("Class " + className + " exists. Not overwriting.");
        seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder);
        return false;
    }
    if (seiContext.getExceptionBeanName(thrownDecl.getQualifiedName()) != null)
        return false;

    //write class comment - JAXWS warning
    JDocComment comment = cls.javadoc();
    for (String doc : GeneratorBase.getJAXWSClassComment(ToolVersion.VERSION.MAJOR_VERSION)) {
        comment.add(doc);
    }

    // XmlElement Declarations
    writeXmlElementDeclaration(cls, name, namespace);

    // XmlType Declaration
    //members = sortMembers(members);
    XmlType xmlType = thrownDecl.getAnnotation(XmlType.class);
    String xmlTypeName = (xmlType != null && !xmlType.name().equals("##default")) ? xmlType.name() : exceptionName;
    String xmlTypeNamespace = (xmlType != null && !xmlType.namespace().equals("##default")) ? xmlType.namespace() : typeNamespace;
    writeXmlTypeDeclaration(cls, xmlTypeName, xmlTypeNamespace, members);

    writeMembers(cls, members);

    seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder);
    return true;
}