Java源码示例:com.sun.xml.internal.ws.api.model.JavaMethod

示例1
@Override
public void addOperationFaultExtension(TypedXmlWriter fault, JavaMethod method, CheckedException ce) {
    if (!enabled)
        return;

    Action a = method.getSEIMethod().getAnnotation(Action.class);
    Class[] exs = method.getSEIMethod().getExceptionTypes();

    if (exs == null)
        return;

    if (a != null && a.fault() != null) {
        for (FaultAction fa : a.fault()) {
            if (fa.className().getName().equals(ce.getExceptionClass().getName())) {
                if (fa.value().equals(""))
                    return;

                addAttribute(fault, fa.value());
                return;
            }
        }
    }
}
 
示例2
protected static final String getDefaultAction(JavaMethod method) {
    String tns = method.getOwner().getTargetNamespace();
    String delim = "/";
    // TODO: is this the correct way to find the separator ?
    try {
        URI uri = new URI(tns);
        if(uri.getScheme().equalsIgnoreCase("urn"))
            delim = ":";
    } catch (URISyntaxException e) {
        LOGGER.warning("TargetNamespace of WebService is not a valid URI");
    }
    if (tns.endsWith(delim))
        tns = tns.substring(0, tns.length() - 1);
    //this assumes that fromjava case there won't be input name.
    // if there is input name in future, then here name=inputName
    //else use operation name as follows.
    String name = (method.getMEP().isOneWay())?method.getOperationName():method.getOperationName()+"Request";

    return new StringBuilder(tns).append(delim).append(
            method.getOwner().getPortTypeName().getLocalPart()).append(
            delim).append(name).toString();
}
 
示例3
@Override
public void addOperationFaultExtension(TypedXmlWriter fault, JavaMethod method, CheckedException ce) {
    if (!enabled)
        return;

    Action a = method.getSEIMethod().getAnnotation(Action.class);
    Class[] exs = method.getSEIMethod().getExceptionTypes();

    if (exs == null)
        return;

    if (a != null && a.fault() != null) {
        for (FaultAction fa : a.fault()) {
            if (fa.className().getName().equals(ce.getExceptionClass().getName())) {
                if (fa.value().equals(""))
                    return;

                addAttribute(fault, fa.value());
                return;
            }
        }
    }
}
 
示例4
public String getOutputAction(Packet packet) {
    //String action = AddressingVersion.UNSET_OUTPUT_ACTION;
    String action = null;
    WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping();
    if (wsdlOp != null) {
        JavaMethod javaMethod = wsdlOp.getJavaMethod();
        if (javaMethod != null) {
            JavaMethodImpl jm = (JavaMethodImpl) javaMethod;
            if (jm != null && jm.getOutputAction() != null && !jm.getOutputAction().equals("")) {
                return jm.getOutputAction();
            }
        }
        WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation();
        if (wbo != null) return getOutputAction(wbo);
    }
    return action;
}
 
示例5
protected static final String getDefaultAction(JavaMethod method) {
    String tns = method.getOwner().getTargetNamespace();
    String delim = "/";
    // TODO: is this the correct way to find the separator ?
    try {
        URI uri = new URI(tns);
        if(uri.getScheme().equalsIgnoreCase("urn"))
            delim = ":";
    } catch (URISyntaxException e) {
        LOGGER.warning("TargetNamespace of WebService is not a valid URI");
    }
    if (tns.endsWith(delim))
        tns = tns.substring(0, tns.length() - 1);
    //this assumes that fromjava case there won't be input name.
    // if there is input name in future, then here name=inputName
    //else use operation name as follows.
    String name = (method.getMEP().isOneWay())?method.getOperationName():method.getOperationName()+"Request";

    return new StringBuilder(tns).append(delim).append(
            method.getOwner().getPortTypeName().getLocalPart()).append(
            delim).append(name).toString();
}
 
示例6
protected static final String getDefaultAction(JavaMethod method) {
    String tns = method.getOwner().getTargetNamespace();
    String delim = "/";
    // TODO: is this the correct way to find the separator ?
    try {
        URI uri = new URI(tns);
        if(uri.getScheme().equalsIgnoreCase("urn"))
            delim = ":";
    } catch (URISyntaxException e) {
        LOGGER.warning("TargetNamespace of WebService is not a valid URI");
    }
    if (tns.endsWith(delim))
        tns = tns.substring(0, tns.length() - 1);
    //this assumes that fromjava case there won't be input name.
    // if there is input name in future, then here name=inputName
    //else use operation name as follows.
    String name = (method.getMEP().isOneWay())?method.getOperationName():method.getOperationName()+"Request";

    return new StringBuilder(tns).append(delim).append(
            method.getOwner().getPortTypeName().getLocalPart()).append(
            delim).append(name).toString();
}
 
示例7
protected static final String getDefaultAction(JavaMethod method) {
    String tns = method.getOwner().getTargetNamespace();
    String delim = "/";
    // TODO: is this the correct way to find the separator ?
    try {
        URI uri = new URI(tns);
        if(uri.getScheme().equalsIgnoreCase("urn"))
            delim = ":";
    } catch (URISyntaxException e) {
        LOGGER.warning("TargetNamespace of WebService is not a valid URI");
    }
    if (tns.endsWith(delim))
        tns = tns.substring(0, tns.length() - 1);
    //this assumes that fromjava case there won't be input name.
    // if there is input name in future, then here name=inputName
    //else use operation name as follows.
    String name = (method.getMEP().isOneWay())?method.getOperationName():method.getOperationName()+"Request";

    return new StringBuilder(tns).append(delim).append(
            method.getOwner().getPortTypeName().getLocalPart()).append(
            delim).append(name).toString();
}
 
示例8
public String getOutputAction(Packet packet) {
    //String action = AddressingVersion.UNSET_OUTPUT_ACTION;
    String action = null;
    WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping();
    if (wsdlOp != null) {
        JavaMethod javaMethod = wsdlOp.getJavaMethod();
        if (javaMethod != null) {
            JavaMethodImpl jm = (JavaMethodImpl) javaMethod;
            if (jm != null && jm.getOutputAction() != null && !jm.getOutputAction().equals("")) {
                return jm.getOutputAction();
            }
        }
        WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation();
        if (wbo != null) return getOutputAction(wbo);
    }
    return action;
}
 
示例9
@Override
public void addBindingOperationFaultExtension(final TypedXmlWriter writer, final JavaMethod method, final CheckedException exception) {
    LOGGER.entering(writer, method, exception);
    if (subjects != null) {
        for (PolicySubject subject : subjects) { // iterate over all subjects in policy map
            if (this.policyMap.isFaultMessageSubject(subject)) {
                final Object concreteSubject = subject.getSubject();
                if (concreteSubject != null) {
                    final String exceptionName = exception == null ? null : exception.getMessageName();
                    if (exceptionName == null) { // no name provided to check
                        writePolicyOrReferenceIt(subject, writer);
                    }
                    if (WSDLBoundFaultContainer.class.isInstance(concreteSubject)) { // is it our class?
                        WSDLBoundFaultContainer faultContainer = (WSDLBoundFaultContainer) concreteSubject;
                        WSDLBoundFault fault = faultContainer.getBoundFault();
                        WSDLBoundOperation operation = faultContainer.getBoundOperation();
                        if (exceptionName.equals(fault.getName()) &&
                                operation.getName().getLocalPart().equals(method.getOperationName())) {
                            writePolicyOrReferenceIt(subject, writer);
                        }
                    }
                    else if (WsdlBindingSubject.class.isInstance(concreteSubject)) {
                        WsdlBindingSubject wsdlSubject = (WsdlBindingSubject) concreteSubject;
                        if ((wsdlSubject.getMessageType() == WsdlBindingSubject.WsdlMessageType.FAULT) &&
                            exception.getOwner().getTargetNamespace().equals(wsdlSubject.getName().getNamespaceURI()) &&
                            exceptionName.equals(wsdlSubject.getName().getLocalPart())) {
                            writePolicyOrReferenceIt(subject, writer);
                        }
                    }
                }
            }
        }
    }
    LOGGER.exiting();
}
 
示例10
@Override
public void addBindingOperationOutputExtension(final TypedXmlWriter output, final JavaMethod method) {
    LOGGER.entering();
    final QName operationName = new QName(method.getOwner().getTargetNamespace(), method.getOperationName());
    selectAndProcessBindingSubject(output, WSDLBoundOperation.class, ScopeType.OUTPUT_MESSAGE, operationName);
    LOGGER.exiting();
}
 
示例11
@SuppressWarnings("FinalStaticMethod")
public static final String getDefaultFaultAction(JavaMethod method, CheckedException ce) {
    String tns = method.getOwner().getTargetNamespace();
    String delim = getDelimiter(tns);
    if (tns.endsWith(delim)) {
        tns = tns.substring(0, tns.length() - 1);
    }

    return new StringBuilder(tns).append(delim).append(
            method.getOwner().getPortTypeName().getLocalPart()).append(
            delim).append(method.getOperationName()).append(delim).append("Fault").append(delim).append(ce.getExceptionClass().getSimpleName()).toString();
}
 
示例12
protected static final String getDefaultInputAction(JavaMethod method) {
    String tns = method.getOwner().getTargetNamespace();
    String delim = getDelimiter(tns);
    if (tns.endsWith(delim))
        tns = tns.substring(0, tns.length() - 1);
    //this assumes that fromjava case there won't be input name.
    // if there is input name in future, then here name=inputName
    //else use operation name as follows.
    String name = (method.getMEP().isOneWay()) ?
            method.getOperationName() : method.getOperationName() + "Request";

    return new StringBuilder(tns).append(delim).append(
            method.getOwner().getPortTypeName().getLocalPart()).append(
            delim).append(name).toString();
}
 
示例13
@Override
public void addBindingOperationExtension(final TypedXmlWriter operation, final JavaMethod method) {
    LOGGER.entering();
    final QName operationName = (method == null) ? null : new QName(method.getOwner().getTargetNamespace(), method.getOperationName());
    selectAndProcessBindingSubject(operation, WSDLBoundOperation.class, ScopeType.OPERATION, operationName);
    LOGGER.exiting();
}
 
示例14
@Override
public void addInputMessageExtension(final TypedXmlWriter message, final JavaMethod method) {
    LOGGER.entering();
    final String messageName = (null == method) ? null : method.getRequestMessageName();
    selectAndProcessSubject(message, WSDLMessage.class, ScopeType.INPUT_MESSAGE, messageName);
    LOGGER.exiting();
}
 
示例15
protected static final String getDefaultInputAction(JavaMethod method) {
    String tns = method.getOwner().getTargetNamespace();
    String delim = getDelimiter(tns);
    if (tns.endsWith(delim))
        tns = tns.substring(0, tns.length() - 1);
    //this assumes that fromjava case there won't be input name.
    // if there is input name in future, then here name=inputName
    //else use operation name as follows.
    String name = (method.getMEP().isOneWay()) ?
            method.getOperationName() : method.getOperationName() + "Request";

    return new StringBuilder(tns).append(delim).append(
            method.getOwner().getPortTypeName().getLocalPart()).append(
            delim).append(name).toString();
}
 
示例16
@Override
public void addOutputMessageExtension(final TypedXmlWriter message, final JavaMethod method) {
    LOGGER.entering();
    final String messageName = (null == method) ? null : method.getResponseMessageName();
    selectAndProcessSubject(message, WSDLMessage.class, ScopeType.OUTPUT_MESSAGE, messageName);
    LOGGER.exiting();
}
 
示例17
@Override
public void addBindingOperationInputExtension(final TypedXmlWriter input, final JavaMethod method) {
    LOGGER.entering();
    final QName operationName = new QName(method.getOwner().getTargetNamespace(), method.getOperationName());
    selectAndProcessBindingSubject(input, WSDLBoundOperation.class, ScopeType.INPUT_MESSAGE, operationName);
    LOGGER.exiting();
}
 
示例18
@Override
public void addFaultMessageExtension(final TypedXmlWriter message, final JavaMethod method, final CheckedException exception) {
    LOGGER.entering();
    final String messageName = (null == exception) ? null : exception.getMessageName();
    selectAndProcessSubject(message, WSDLMessage.class, ScopeType.FAULT_MESSAGE, messageName);
    LOGGER.exiting();
}
 
示例19
@Override
public void addInputMessageExtension(final TypedXmlWriter message, final JavaMethod method) {
    LOGGER.entering();
    final String messageName = (null == method) ? null : method.getRequestMessageName();
    selectAndProcessSubject(message, WSDLMessage.class, ScopeType.INPUT_MESSAGE, messageName);
    LOGGER.exiting();
}
 
示例20
protected static final String getDefaultOutputAction(JavaMethod method) {
    String tns = method.getOwner().getTargetNamespace();
    String delim = getDelimiter(tns);
    if (tns.endsWith(delim))
        tns = tns.substring(0, tns.length() - 1);
    //this assumes that fromjava case there won't be output name.
    // if there is input name in future, then here name=outputName
    //else use operation name as follows.
    String name = method.getOperationName() + "Response";

    return new StringBuilder(tns).append(delim).append(
            method.getOwner().getPortTypeName().getLocalPart()).append(
            delim).append(name).toString();
}
 
示例21
private static final String getInputAction(JavaMethod method) {
    String inputaction = ((JavaMethodImpl)method).getInputAction();
    if (inputaction.equals("")) {
        // Calculate default action
        inputaction = getDefaultInputAction(method);
    }
    return inputaction;
}
 
示例22
@Override
public void addOutputMessageExtension(final TypedXmlWriter message, final JavaMethod method) {
    LOGGER.entering();
    final String messageName = (null == method) ? null : method.getResponseMessageName();
    selectAndProcessSubject(message, WSDLMessage.class, ScopeType.OUTPUT_MESSAGE, messageName);
    LOGGER.exiting();
}
 
示例23
public JavaMethod getJavaMethod() {
    return javaMethod;
}
 
示例24
public void addBindingOperationOutputExtension(TypedXmlWriter output, JavaMethod method) {
    for (WSDLGeneratorExtension e : extensions)
        e.addBindingOperationOutputExtension(output, method);
}
 
示例25
public void addBindingOperationOutputExtension(TypedXmlWriter output, JavaMethod method) {
    for (WSDLGeneratorExtension e : extensions)
        e.addBindingOperationOutputExtension(output, method);
}
 
示例26
public void addFaultMessageExtension(TypedXmlWriter message, JavaMethod method, CheckedException ce) {
    for (WSDLGeneratorExtension e : extensions)
        e.addFaultMessageExtension(message, method, ce);
}
 
示例27
@Override
public void addOperationOutputExtension(TypedXmlWriter output,
                                        JavaMethod method) {
    output._attribute(WSAM_ACTION_QNAME, getOutputAction(method));
}
 
示例28
public JavaMethod getOperationModel() {
    return javaMethod;
}
 
示例29
public void addBindingOperationExtension(TypedXmlWriter operation, JavaMethod method) {
    for (WSDLGeneratorExtension e : extensions)
        e.addBindingOperationExtension(operation, method);
}
 
示例30
@Override
public void addOperationInputExtension(TypedXmlWriter input,
                                       JavaMethod method) {
    input._attribute(WSAM_ACTION_QNAME, getInputAction(method));
}