Search in sources :

Example 56 with Message

use of org.apache.cxf.common.i18n.Message in project cxf by apache.

the class SequenceFaultFactory method createMessageNumberRolloverFault.

SequenceFault createMessageNumberRolloverFault(Identifier sid) {
    Message msg = new Message("MESSAGE_NR_ROLLOVER_EXC", BUNDLE);
    SequenceFault fault = new SequenceFault(msg.toString());
    fault.setDetail(sid);
    fault.setSender(true);
    fault.setFaultCode(constants.getMessageNumberRolloverFaultCode());
    return fault;
}
Also used : Message(org.apache.cxf.common.i18n.Message)

Example 57 with Message

use of org.apache.cxf.common.i18n.Message in project cxf by apache.

the class SequenceFaultFactory method createCreateSequenceRefusedFault.

SequenceFault createCreateSequenceRefusedFault() {
    Message msg = new Message("CREATE_SEQ_REFUSED", BUNDLE);
    SequenceFault fault = new SequenceFault(msg.toString());
    fault.setSender(true);
    fault.setFaultCode(constants.getCreateSequenceRefusedFaultCode());
    return fault;
}
Also used : Message(org.apache.cxf.common.i18n.Message)

Example 58 with Message

use of org.apache.cxf.common.i18n.Message in project cxf by apache.

the class JavaToWSDLProcessor method getOutputFile.

protected File getOutputFile(File nameFromClz, String defaultOutputFile) {
    String output = (String) context.get(ToolConstants.CFG_OUTPUTFILE);
    String dir = (String) context.get(ToolConstants.CFG_OUTPUTDIR);
    if (dir == null) {
        dir = "./";
    }
    File result;
    if (output != null) {
        result = new File(output);
        if (!result.isAbsolute()) {
            result = new File(new File(dir), output);
        }
    } else {
        result = new File(new File(dir), defaultOutputFile);
    }
    if (nameFromClz != null) {
        result = nameFromClz;
    }
    // rename the exising wsdl file
    if (result.exists() && !result.renameTo(new File(result.getParent(), result.getName()))) {
        throw new ToolException(new Message("OUTFILE_EXISTS", LOG));
    }
    return result;
}
Also used : Message(org.apache.cxf.common.i18n.Message) ToolException(org.apache.cxf.tools.common.ToolException) File(java.io.File)

Example 59 with Message

use of org.apache.cxf.common.i18n.Message in project cxf by apache.

the class JAXWSFrontEndProcessor method checkJaxwsClass.

public void checkJaxwsClass() {
    Class<?> clz = context.get(Class.class);
    WebService webServiceAnno = clz.getAnnotation(WebService.class);
    if (webServiceAnno == null) {
        Message msg = new Message("CLASS_DOESNOT_CARRY_WEBSERVICE_ANNO", LOG, clz.getName());
        LOG.log(Level.WARNING, msg.toString());
        throw new ToolException(msg);
    }
    if (isImplRmiRemote(clz)) {
        Message msg = new Message("PARA_OR_RETURN_IMPL_REMOTE", LOG, clz.getName());
        LOG.log(Level.WARNING, msg.toString());
        throw new ToolException(msg);
    }
}
Also used : Message(org.apache.cxf.common.i18n.Message) WebService(javax.jws.WebService) ToolException(org.apache.cxf.tools.common.ToolException)

Example 60 with Message

use of org.apache.cxf.common.i18n.Message in project cxf by apache.

the class JavaToWSContainer method checkParams.

public void checkParams(ErrorVisitor errs) throws ToolException {
    super.checkParams(errs);
    CommandDocument doc = super.getCommandDocument();
    if (doc.hasParameter(ToolConstants.CFG_FRONTEND)) {
        String ft = doc.getParameter(ToolConstants.CFG_FRONTEND);
        if (!ToolConstants.JAXWS_FRONTEND.equals(ft) && !ToolConstants.SIMPLE_FRONTEND.equals(ft)) {
            Message msg = new Message("INVALID_FRONTEND", LOG, new Object[] { ft });
            errs.add(new ErrorVisitor.UserError(msg.toString()));
        }
        if (ToolConstants.SIMPLE_FRONTEND.equals(ft) && doc.getParameter(ToolConstants.CFG_DATABINDING) != null && !ToolConstants.AEGIS_DATABINDING.equals(doc.getParameter(ToolConstants.CFG_DATABINDING))) {
            Message msg = new Message("INVALID_DATABINDING_FOR_SIMPLE", LOG);
            errs.add(new ErrorVisitor.UserError(msg.toString()));
        }
    }
    if (doc.hasParameter(ToolConstants.CFG_WRAPPERBEAN)) {
        String ft = doc.getParameter(ToolConstants.CFG_FRONTEND);
        if (ft != null && !ToolConstants.JAXWS_FRONTEND.equals(ft)) {
            Message msg = new Message("WRAPPERBEAN_WITHOUT_JAXWS", LOG);
            errs.add(new ErrorVisitor.UserError(msg.toString()));
        }
    }
    if (errs.getErrors().size() > 0) {
        Message msg = new Message("PARAMETER_MISSING", LOG);
        throw new ToolException(msg, new BadUsageException(getUsage(), errs));
    }
}
Also used : Message(org.apache.cxf.common.i18n.Message) BadUsageException(org.apache.cxf.tools.common.toolspec.parser.BadUsageException) CommandDocument(org.apache.cxf.tools.common.toolspec.parser.CommandDocument) ToolException(org.apache.cxf.tools.common.ToolException) ErrorVisitor(org.apache.cxf.tools.common.toolspec.parser.ErrorVisitor)

Aggregations

Message (org.apache.cxf.common.i18n.Message)201 ToolException (org.apache.cxf.tools.common.ToolException)69 IOException (java.io.IOException)45 QName (javax.xml.namespace.QName)42 Fault (org.apache.cxf.interceptor.Fault)34 XMLStreamException (javax.xml.stream.XMLStreamException)27 JAXBException (javax.xml.bind.JAXBException)23 ArrayList (java.util.ArrayList)19 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)17 Element (org.w3c.dom.Element)17 File (java.io.File)16 WSDLException (javax.wsdl.WSDLException)15 Method (java.lang.reflect.Method)14 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)13 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)12 InputStream (java.io.InputStream)11 HashMap (java.util.HashMap)11 List (java.util.List)11 Map (java.util.Map)11 ServiceConstructionException (org.apache.cxf.service.factory.ServiceConstructionException)11