use of com.centurylink.mdw.service.ApplicationSummaryDocument.ApplicationSummary in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method retrieveRemoteAppSummary.
public void retrieveRemoteAppSummary(final boolean errorDialogOnFailure) {
Runnable runnable = new Runnable() {
public void run() {
// bypass designer proxy to delay lazy loading if project hasn't
// been opened
HttpHelper httpHelper;
String url = getAppSummaryUrl() + "/Services/AppSummary?format=json";
try {
httpHelper = new HttpHelper(new URL(url));
httpHelper.setConnectTimeout(MdwPlugin.getSettings().getHttpConnectTimeout());
httpHelper.setReadTimeout(MdwPlugin.getSettings().getHttpReadTimeout());
remoteAppSummary = new AppSummary(new JSONObject(httpHelper.get()));
} catch (JSONException ex) {
try {
url = getAppSummaryUrl() + "/Services/GetAppSummary";
httpHelper = new HttpHelper(new URL(url));
httpHelper.setConnectTimeout(MdwPlugin.getSettings().getHttpConnectTimeout());
httpHelper.setReadTimeout(MdwPlugin.getSettings().getHttpReadTimeout());
String response = httpHelper.get();
if (response != null && (response.trim().startsWith("<xs:MDWStatusMessage") || response.trim().startsWith("<bpm:MDWStatusMessage"))) {
MDWStatusMessageDocument msgDoc = MDWStatusMessageDocument.Factory.parse(response, Compatibility.namespaceOptions());
throw new IOException("Server error: " + msgDoc.getMDWStatusMessage().getStatusMessage());
}
ApplicationSummary docAppSummary = ApplicationSummaryDocument.Factory.parse(response, Compatibility.namespaceOptions()).getApplicationSummary();
remoteAppSummary = new AppSummary();
remoteAppSummary.setAppId(docAppSummary.getApplicationName());
remoteAppSummary.setMdwVersion(docAppSummary.getMdwVersion());
remoteAppSummary.setMdwBuild(docAppSummary.getBuild());
remoteAppSummary.setMdwHubUrl(docAppSummary.getMdwHubUrl());
remoteAppSummary.setServicesUrl(docAppSummary.getServicesUrl());
if (docAppSummary.getRepository() != null) {
Repository repo = new Repository();
remoteAppSummary.setRepository(repo);
repo.setBranch(docAppSummary.getRepository().getBranch());
repo.setCommit(docAppSummary.getRepository().getCommit());
repo.setProvider(docAppSummary.getRepository().getProvider());
repo.setUrl(docAppSummary.getRepository().getUrl());
}
DbInfo dbInfo = new DbInfo();
remoteAppSummary.setDbInfo(dbInfo);
dbInfo.setJdbcUrl(docAppSummary.getDbInfo().getJdbcUrl());
dbInfo.setUser(docAppSummary.getDbInfo().getUser());
} catch (IOException e) {
PluginMessages.log(ex);
if (errorDialogOnFailure)
MessageDialog.openError(MdwPlugin.getShell(), "Authentication", "Server appears to be offline: " + e.getMessage());
} catch (Exception e) {
PluginMessages.log(e);
if (errorDialogOnFailure)
PluginMessages.uiError(e, "Remote App Summary", WorkflowProject.this);
}
} catch (IOException ex) {
PluginMessages.log(ex);
if (errorDialogOnFailure)
MessageDialog.openError(MdwPlugin.getShell(), "Authentication", "Server appears to be offline: " + ex.getMessage());
} catch (Exception ex) {
PluginMessages.log(ex);
if (errorDialogOnFailure)
PluginMessages.uiError(ex, "Remote App Summary", WorkflowProject.this);
}
}
};
if (MdwPlugin.isUiThread())
BusyIndicator.showWhile(MdwPlugin.getDisplay(), runnable);
else
runnable.run();
}
Aggregations