use of org.apache.cxf.tools.common.ToolException in project cxf by apache.
the class PluginLoader method loadPlugin.
public void loadPlugin(URL url) throws IOException {
try {
LOG.log(Level.FINE, "PLUGIN_LOADING", url);
loadPlugin(getPlugin(url));
} catch (JAXBException e) {
Message msg = new Message("PLUGIN_LOAD_FAIL", LOG, url);
LOG.log(Level.SEVERE, msg.toString());
throw new ToolException(msg, e);
}
}
use of org.apache.cxf.tools.common.ToolException in project cxf by apache.
the class PluginLoader method getPlugin.
protected Plugin getPlugin(URL url) throws IOException, JAXBException, FileNotFoundException {
Plugin plugin = plugins.get(url.toString());
InputStream is = null;
if (plugin == null) {
is = url.openStream();
plugin = getPlugin(is);
if (plugin == null || StringUtils.isEmpty(plugin.getName())) {
Message msg = new Message("PLUGIN_LOAD_FAIL", LOG, url);
LOG.log(Level.SEVERE, msg.toString());
throw new ToolException(msg);
}
plugins.put(url.toString(), plugin);
}
if (is == null) {
return getPlugin(url.toString());
}
return plugin;
}
use of org.apache.cxf.tools.common.ToolException in project cxf by apache.
the class PluginLoader method getFrontEndGenerators.
private List<FrontEndGenerator> getFrontEndGenerators(FrontEnd frontend) {
List<FrontEndGenerator> generators = new ArrayList<>();
String fullClzName = null;
try {
for (Generator generator : frontend.getGenerators().getGenerator()) {
fullClzName = getGeneratorClass(frontend, generator);
Class<?> clz = ClassLoaderUtils.loadClass(fullClzName, this.getClass());
generators.add((FrontEndGenerator) clz.newInstance());
}
} catch (Exception e) {
Message msg = new Message("FRONTEND_PROFILE_LOAD_FAIL", LOG, fullClzName);
LOG.log(Level.SEVERE, msg.toString());
throw new ToolException(msg, e);
}
return generators;
}
use of org.apache.cxf.tools.common.ToolException in project cxf by apache.
the class WSDLToJavaContainerTest method testValidateorSuppressWarningsIsOn.
@Test
public void testValidateorSuppressWarningsIsOn() throws Exception {
WSDLToJavaContainer container = new WSDLToJavaContainer("dummy", null);
ToolContext context = new ToolContext();
context.put(ToolConstants.CFG_WSDLURL, getLocation("hello_world.wsdl"));
container.setContext(context);
try {
container.execute();
} catch (ToolException te) {
assertEquals(getLogMessage("FOUND_NO_FRONTEND"), te.getMessage());
} catch (Exception e) {
fail("Should not throw any exception but ToolException.");
}
assertTrue(context.optionSet(ToolConstants.CFG_SUPPRESS_WARNINGS));
}
use of org.apache.cxf.tools.common.ToolException in project cxf by apache.
the class WSDLToJavaContainerTest method testNoPlugin.
@Test
public void testNoPlugin() throws Exception {
WSDLToJavaContainer container = new WSDLToJavaContainer("dummy", null);
ToolContext context = new ToolContext();
context.put(ToolConstants.CFG_WSDLURL, getLocation("hello_world.wsdl"));
container.setContext(context);
try {
container.execute();
} catch (ToolException te) {
assertEquals(getLogMessage("FOUND_NO_FRONTEND"), te.getMessage());
} catch (Exception e) {
fail("Should not throw any exception but ToolException.");
}
}
Aggregations