use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class WSDLToServiceProcessor method doAppendService.
private void doAppendService() throws ToolException {
if (service == null) {
service = wsdlDefinition.createService();
service.setQName(new QName(WSDLConstants.WSDL_PREFIX, (String) env.get(ToolConstants.CFG_SERVICE)));
}
if (port == null) {
port = wsdlDefinition.createPort();
port.setName((String) env.get(ToolConstants.CFG_PORT));
port.setBinding(binding);
}
setAddrElement();
service.addPort(port);
wsdlDefinition.addService(service);
WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
Writer outputWriter = getOutputWriter(NEW_FILE_NAME_MODIFIER);
try {
wsdlWriter.writeWSDL(wsdlDefinition, outputWriter);
} catch (WSDLException wse) {
Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG);
throw new ToolException(msg, wse);
}
try {
outputWriter.close();
} catch (IOException ioe) {
Message msg = new Message("FAIL_TO_CLOSE_WSDL_FILE", LOG);
throw new ToolException(msg, ioe);
}
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class WSDLToServiceProcessor method process.
public void process() throws ToolException {
init();
if (isServicePortExisted()) {
Message msg = new Message("SERVICE_PORT_EXIST", LOG);
throw new ToolException(msg);
}
if (!isBindingExisted()) {
Message msg = new Message("BINDING_NOT_EXIST", LOG);
throw new ToolException(msg);
}
doAppendService();
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class WSDLToServiceProcessor method setAddrElement.
private void setAddrElement() throws ToolException {
String transport = (String) env.get(ToolConstants.CFG_TRANSPORT);
Address address = AddressFactory.getInstance().getAddresser(transport);
Map<String, String> ns = address.getNamespaces(env);
for (Map.Entry<String, String> entry : ns.entrySet()) {
wsdlDefinition.addNamespace(entry.getKey(), entry.getValue());
}
WSDLExtensibilityPlugin plugin = getWSDLPlugin(transport, Port.class);
try {
ExtensibilityElement extElement = plugin.createExtension(address.buildAddressArguments(env));
port.addExtensibilityElement(extElement);
} catch (WSDLException wse) {
Message msg = new Message("FAIL_TO_CREATE_SOAP_ADDRESS", LOG);
throw new ToolException(msg, wse);
}
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class ProviderImpl method createEndpoint.
@Override
public Endpoint createEndpoint(String bindingId, Object implementor) {
Endpoint ep = null;
if (EndpointUtils.isValidImplementor(implementor)) {
Bus bus = BusFactory.getThreadDefaultBus();
ep = createEndpointImpl(bus, bindingId, implementor);
return ep;
}
throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString());
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class JMSConfigFeature method initialize.
@Override
public void initialize(Server server, Bus bus) {
checkJmsConfig();
Destination destination = server.getDestination();
if (!(destination instanceof JMSDestination)) {
throw new ConfigurationException(new Message("JMSCONFIGFEATURE_ONLY_JMS", LOG));
}
JMSDestination jmsDestination = (JMSDestination) destination;
jmsDestination.setJmsConfig(jmsConfig);
super.initialize(server, bus);
}
Aggregations