Search in sources :

Example 1 with AbortException

use of com.sun.tools.ws.wscompile.AbortException in project metro-jax-ws by eclipse-ee4j.

the class AbstractDocument method define.

public void define(GloballyKnown e) {
    Map map = getMap(e.getKind());
    if (e.getName() == null)
        return;
    QName name = new QName(e.getDefining().getTargetNamespaceURI(), e.getName());
    if (map.containsKey(name)) {
        errReceiver.error(e.getLocator(), WsdlMessages.ENTITY_DUPLICATE_WITH_TYPE(e.getElementName().getLocalPart(), e.getName()));
        throw new AbortException();
    } else {
        map.put(name, e);
    }
}
Also used : QName(javax.xml.namespace.QName) HashMap(java.util.HashMap) Map(java.util.Map) AbortException(com.sun.tools.ws.wscompile.AbortException)

Example 2 with AbortException

use of com.sun.tools.ws.wscompile.AbortException in project metro-jax-ws by eclipse-ee4j.

the class AbstractDocument method find.

public GloballyKnown find(Kind k, QName name) {
    Map map = getMap(k);
    Object result = map.get(name);
    if (result == null) {
        errReceiver.error(null, WsdlMessages.ENTITY_NOT_FOUND_BY_Q_NAME(k.getName(), name, _systemId));
        throw new AbortException();
    }
    return (GloballyKnown) result;
}
Also used : HashMap(java.util.HashMap) Map(java.util.Map) AbortException(com.sun.tools.ws.wscompile.AbortException)

Example 3 with AbortException

use of com.sun.tools.ws.wscompile.AbortException in project metro-jax-ws by eclipse-ee4j.

the class ModelerUtils method createRpcLitParameters.

public static List<Parameter> createRpcLitParameters(Message message, Block block, S2JJAXBModel jaxbModel, ErrorReceiverFilter errReceiver) {
    RpcLitStructure rpcStruct = (RpcLitStructure) block.getType();
    List<Parameter> parameters = new ArrayList<>();
    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;
}
Also used : QName(javax.xml.namespace.QName) MessagePart(com.sun.tools.ws.wsdl.document.MessagePart) JavaSimpleType(com.sun.tools.ws.processor.model.java.JavaSimpleType) ArrayList(java.util.ArrayList) JavaType(com.sun.tools.ws.processor.model.java.JavaType) TypeAndAnnotation(com.sun.tools.xjc.api.TypeAndAnnotation) Parameter(com.sun.tools.ws.processor.model.Parameter) AbortException(com.sun.tools.ws.wscompile.AbortException)

Example 4 with AbortException

use of com.sun.tools.ws.wscompile.AbortException in project metro-jax-ws by eclipse-ee4j.

the class WSDLParserTest method createErrorReceiver.

private static ErrorReceiverFilter createErrorReceiver() {
    class Listener extends WsimportListener {

        ConsoleErrorReporter cer = new ConsoleErrorReporter(System.err);

        @Override
        public void generatedFile(String fileName) {
            message(fileName);
        }

        @Override
        public void message(String msg) {
            System.out.println(msg);
        }

        @Override
        public void error(SAXParseException exception) {
            cer.error(exception);
        }

        @Override
        public void fatalError(SAXParseException exception) {
            cer.fatalError(exception);
        }

        @Override
        public void warning(SAXParseException exception) {
            cer.warning(exception);
        }

        @Override
        public void debug(SAXParseException exception) {
            cer.debug(exception);
        }

        @Override
        public void info(SAXParseException exception) {
            cer.info(exception);
        }

        public void enableDebugging() {
            cer.enableDebugging();
        }
    }
    final Listener listener = new Listener();
    ErrorReceiverFilter errorReceiver = new ErrorReceiverFilter(listener) {

        public void info(SAXParseException exception) {
            super.info(exception);
        }

        public void warning(SAXParseException exception) {
            super.warning(exception);
        }

        @Override
        public void pollAbort() throws AbortException {
            if (listener.isCanceled()) {
                throw new AbortException();
            }
        }

        @Override
        public void debug(SAXParseException exception) {
            listener.debug(exception);
        }
    };
    return errorReceiver;
}
Also used : WsimportListener(com.sun.tools.ws.wscompile.WsimportListener) WsimportListener(com.sun.tools.ws.wscompile.WsimportListener) ErrorReceiverFilter(com.sun.tools.ws.wscompile.ErrorReceiverFilter) SAXParseException(org.xml.sax.SAXParseException) ConsoleErrorReporter(com.sun.tools.ws.processor.modeler.wsdl.ConsoleErrorReporter) AbortException(com.sun.tools.ws.wscompile.AbortException)

Example 5 with AbortException

use of com.sun.tools.ws.wscompile.AbortException in project metro-jax-ws by eclipse-ee4j.

the class JAXBModelBuilder method bind.

protected void bind() {
    S2JJAXBModel rawJaxbModel = schemaCompiler.bind();
    if (rawJaxbModel == null)
        throw new AbortException();
    options.setCodeModel(rawJaxbModel.generateCode(null, errReceiver));
    jaxbModel = new JAXBModel(rawJaxbModel);
    jaxbModel.setGeneratedClassNames(_classNameAllocator.getJaxbGeneratedClasses());
}
Also used : S2JJAXBModel(com.sun.tools.xjc.api.S2JJAXBModel) JAXBModel(com.sun.tools.ws.processor.model.jaxb.JAXBModel) S2JJAXBModel(com.sun.tools.xjc.api.S2JJAXBModel) AbortException(com.sun.tools.ws.wscompile.AbortException)

Aggregations

AbortException (com.sun.tools.ws.wscompile.AbortException)5 HashMap (java.util.HashMap)2 Map (java.util.Map)2 QName (javax.xml.namespace.QName)2 Parameter (com.sun.tools.ws.processor.model.Parameter)1 JavaSimpleType (com.sun.tools.ws.processor.model.java.JavaSimpleType)1 JavaType (com.sun.tools.ws.processor.model.java.JavaType)1 JAXBModel (com.sun.tools.ws.processor.model.jaxb.JAXBModel)1 ConsoleErrorReporter (com.sun.tools.ws.processor.modeler.wsdl.ConsoleErrorReporter)1 ErrorReceiverFilter (com.sun.tools.ws.wscompile.ErrorReceiverFilter)1 WsimportListener (com.sun.tools.ws.wscompile.WsimportListener)1 MessagePart (com.sun.tools.ws.wsdl.document.MessagePart)1 S2JJAXBModel (com.sun.tools.xjc.api.S2JJAXBModel)1 TypeAndAnnotation (com.sun.tools.xjc.api.TypeAndAnnotation)1 ArrayList (java.util.ArrayList)1 SAXParseException (org.xml.sax.SAXParseException)1