use of com.amalto.workbench.service.MissingJarsException in project tmdm-studio-se by Talend.
the class Util method getMDMService.
public static TMDMService getMDMService(URL url, final String username, final String password, boolean showMissingJarDialog) throws XtentisException {
url = checkAndAddSuffix(url);
boolean needCheck = true;
TMDMService service = (TMDMService) cachedMDMService.get(url, username, password);
if (service == null) {
needCheck = false;
boolean checkResult = MissingJarService.getInstance().checkMissingJar(showMissingJarDialog);
if (!checkResult) {
// $NON-NLS-1$
throw new MissingJarsException("Missing dependency libraries.");
}
try {
TMDMService_Service service_service = new TMDMService_Service(url);
service = service_service.getTMDMPort();
BindingProvider stub = (BindingProvider) service;
// Do not maintain session via cookies
stub.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, false);
Map<String, Object> context = stub.getRequestContext();
// // dynamic set endpointAddress
// context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);
// authentication
context.put(BindingProvider.USERNAME_PROPERTY, username);
context.put(BindingProvider.PASSWORD_PROPERTY, password);
IWebServiceHook wsHook = getWebServiceHook();
if (wsHook != null) {
wsHook.preRequestSendingHook(stub, username);
}
cachedMDMService.put(url, username, password, service);
} catch (WebServiceException e) {
XtentisException ex = convertWebServiceException(e);
log.error(Messages.bind(Messages.UnableAccessEndpoint, url, e.getMessage()), e);
if (ex != null) {
throw ex;
}
}
}
if (needCheck) {
try {
service.ping(new WSPing());
} catch (WebServiceException e) {
cachedMDMService.remove(url, username, password);
XtentisException ex = convertWebServiceException(e);
log.error(Messages.bind(Messages.UnableAccessEndpoint, url, e.getMessage()), e);
if (ex != null) {
throw ex;
}
}
}
return service;
}
use of com.amalto.workbench.service.MissingJarsException in project tmdm-studio-se by Talend.
the class ServerDefDialog method buttonPressed.
@Override
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
if (!validateInput()) {
return;
}
updateUI2Model(serverDef);
}
if (buttonId == CHECK_CONNECTION_ID) {
if (!validateInput()) {
return;
}
MDMServerDef tmpServerDef = MdmmetadataFactory.eINSTANCE.createMDMServerDef();
tmpServerDef.setAlgorithm(PasswordUtil.ALGORITHM_COMMON_V2);
updateUI2Model(tmpServerDef);
try {
ServerDefService.checkMDMConnection(tmpServerDef.getDecryptedServerDef());
setMessage(Messages.ServerExplorer_ConnectSuccessful);
} catch (MissingJarsException e) {
return;
} catch (XtentisException e) {
setErrorMessage(Messages.ServerExplorer_ConnectFailed);
} catch (MalformedURLException e) {
setErrorMessage(Messages.ServerExplorer_ConnectFailed);
}
}
super.buttonPressed(buttonId);
}
Aggregations