Java Code Examples for org.apache.cxf.service.model.OperationInfo#getExtensor()

The following examples show how to use org.apache.cxf.service.model.OperationInfo#getExtensor() . 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: WrapperStyleNameCollisionValidator.java    From cxf with Apache License 2.0 5 votes vote down vote up
private String mapElementName(OperationInfo op, MessageInfo mi, WrapperElement element) {
    MessagePartInfo mpi = mi.getMessagePart(element.getElementName());
    JAXWSBinding bind = op.getExtensor(JAXWSBinding.class);
    if (bind != null && bind.getJaxwsParas() != null) {
        for (JAXWSParameter par : bind.getJaxwsParas()) {
            if (mi.getName().getLocalPart().equals(par.getMessageName())
                && mpi.getName().getLocalPart().equals(par.getElementName().getLocalPart())) {
                return par.getName();
            }
        }
    }
    return mpi.getElementQName().getLocalPart();
}
 
Example 2
Source File: MethodMapper.java    From cxf with Apache License 2.0 5 votes vote down vote up
public JavaMethod map(OperationInfo operation) {
    JavaMethod method = new JavaMethod();
    // set default Document Bare style
    method.setSoapStyle(javax.jws.soap.SOAPBinding.Style.DOCUMENT);

    String operationName = operation.getName().getLocalPart();

    method.setName(ProcessorUtil.mangleNameToVariableName(operationName));
    method.setOperationName(operationName);

    JAXWSBinding opBinding = operation.getExtensor(JAXWSBinding.class);
    if (opBinding != null
        && opBinding.getMethodName() != null) {
        method.setName(opBinding.getMethodName());
    }

    if (opBinding != null
        && opBinding.getMethodJavaDoc() != null) {
        method.setJavaDoc(opBinding.getMethodJavaDoc());
    } else {
        method.setJavaDoc(operation.getDocumentation());
    }

    if (operation.isOneWay()) {
        method.setStyle(OperationType.ONE_WAY);
    } else {
        method.setStyle(OperationType.REQUEST_RESPONSE);
    }

    method.setWrapperStyle(operation.isUnwrappedCapable());

    return method;
}
 
Example 3
Source File: OperationProcessor.java    From cxf with Apache License 2.0 4 votes vote down vote up
void processMethod(JavaMethod method,
                   OperationInfo operation) throws ToolException {
    if (isAsyncMethod(method)) {
        return;
    }
    MessageInfo inputMessage = operation.getInput();
    MessageInfo outputMessage = operation.getOutput();

    if (inputMessage == null) {
        LOG.log(Level.WARNING, "NO_INPUT_MESSAGE", new Object[] {operation.getName()});
        org.apache.cxf.common.i18n.Message msg
            = new org.apache.cxf.common.i18n.Message("INVALID_MEP", LOG,
                                                           new Object[] {operation.getName()});
        throw new ToolException(msg);
    }

    ParameterProcessor paramProcessor = new ParameterProcessor(context);
    method.clear();

    JAXWSBinding opBinding = operation.getExtensor(JAXWSBinding.class);
    JAXWSBinding ptBinding = operation.getInterface().getExtensor(JAXWSBinding.class);
    JAXWSBinding defBinding = operation.getInterface().getService()
        .getDescription().getExtensor(JAXWSBinding.class);

    boolean enableAsync = false;
    boolean enableMime = false;
    boolean enableWrapper = method.isWrapperStyle();
    if (defBinding != null) {
        if (defBinding.isSetEnableMime()) {
            enableMime = defBinding.isEnableMime();
        }
        if (defBinding.isSetEnableAsyncMapping()) {
            enableAsync = defBinding.isEnableAsyncMapping();
        }
        if (defBinding.isSetEnableWrapperStyle()) {
            enableWrapper = defBinding.isEnableWrapperStyle();
        }
    }
    if (ptBinding != null) {
        if (ptBinding.isSetEnableMime()) {
            enableMime = ptBinding.isEnableMime();
        }
        if (ptBinding.isSetEnableAsyncMapping()) {
            enableAsync = ptBinding.isEnableAsyncMapping();
        }
        if (ptBinding.isSetEnableWrapperStyle()) {
            enableWrapper = ptBinding.isEnableWrapperStyle();
        }
    }
    if (opBinding != null) {
        if (opBinding.isSetEnableMime()) {
            enableMime = opBinding.isEnableMime();
        }
        if (opBinding.isSetEnableAsyncMapping()) {
            enableAsync = opBinding.isEnableAsyncMapping();
        }
        if (opBinding.isSetEnableWrapperStyle()) {
            enableWrapper = opBinding.isEnableWrapperStyle();
        }
    }

    enableWrapper = checkEnableWrapper(enableWrapper, method);
    enableAsync = checkEnableAsync(enableAsync, method);
    enableMime = checkEnableMime(enableMime, method);

    method.setWrapperStyle(enableWrapper && method.isWrapperStyle());


    paramProcessor.process(method,
                           inputMessage,
                           outputMessage,
                           operation.getParameterOrdering());

    if (method.isWrapperStyle()) {
        setWrapper(operation);
        method.annotate(new WrapperAnnotator(wrapperRequest, wrapperResponse));
    }

    method.annotate(new WebMethodAnnotator());


    method.annotate(new WebResultAnnotator());


    if (!method.isOneWay()
        && enableAsync && !isAddedAsycMethod(method)) {
        addAsyncMethod(method);
    }
    if (enableMime) {
        method.setMimeEnable(true);
    }
}