public void setDefinition(String wsdlUrl, boolean updateCache) throws Exception { String old = definitionProperty.set(wsdlUrl, false); if (wsdlContext != null) { wsdlContext.setDefinition(definitionProperty.expandUrl(), updateCache); } notifyPropertyChanged(DEFINITION_PROPERTY, old, wsdlUrl); notifyPropertyChanged(UPDATING_PROPERTY, true, false); }
public String getDefinition() { if (!getConfig().isSetDefinition()) return null; String result = definitionProperty.get(); if (PathUtils.isFilePath(result) && !PathUtils.isRelativePath(result) && !result.startsWith("file:") && !result.startsWith("$")) { try { result = new File(result).toURI().toURL().toString(); } catch (MalformedURLException e) { e.printStackTrace(); } } return result; }
@SuppressWarnings("unchecked") @Override public void resolve(ResolveContext<?> context) { super.resolve(context); String definition = definitionProperty.expandUrl(); if (!isCached() && definition.startsWith("file:")) { try { File file = new File(definition.substring(5)); if (!file.exists()) { if (context.hasThisModelItem(this, "Missing WSDL file", definition)) return; context.addPathToResolve( this, "Missing WSDL file", definition, new ResolveContext.FileResolver( "Select WSDL File", "wsdl", "WSDL Files (*.wsdl)", file.getParent()) { @Override public boolean apply(File newFile) { try { setDefinition(newFile.toURI().toURL().toString()); return true; } catch (Exception e) { log.error("Invalid URL for new Definition", e); return false; } } }); } else { if (context.hasThisModelItem(this, "Missing WSDL file", definition)) context.getPath(this, "Missing WSDL file", definition).setSolved(true); } } catch (Exception e) { e.printStackTrace(); } } }