use of com.amalto.workbench.utils.MDMServerDef in project tmdm-studio-se by Talend.
the class DataClusterDialog method hookService.
private void hookService() {
serverComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
refreshDataContainerCombo();
MDMServerDef serverDef = getSelectedMdmServerDef();
if (serverDef != oldServerDef) {
oldServerDef = serverDef;
clusterComposite.changeToServer(serverDef);
changeWidgetColor(greyColor);
}
selectDefaultContainer();
}
});
containerComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection ssel = (IStructuredSelection) containerComboViewer.getSelection();
TreeObject dataContainer = (TreeObject) ssel.getFirstElement();
boolean refreshed = clusterComposite.changeToDataContainer(dataContainer);
if (refreshed) {
changeWidgetColor(defaultColor);
} else {
changeWidgetColor(greyColor);
containerComboViewer.setInput(dataContainers);
}
model = clusterComposite.getDataContainer();
}
});
TableViewer resultsViewer = clusterComposite.getResultsViewer();
resultsViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection structedSelection = (IStructuredSelection) event.getSelection();
selected = (LineItem) structedSelection.getFirstElement();
showInTextWidget(selected);
}
});
}
use of com.amalto.workbench.utils.MDMServerDef in project tmdm-studio-se by Talend.
the class DataClusterDialog method createFirstLine.
private Composite createFirstLine(Composite parent) {
Composite firstLine = new Composite(parent, SWT.NONE);
firstLine.setLayout(new GridLayout(4, false));
Label serverLabel = new Label(firstLine, SWT.NONE);
serverLabel.setText(Messages.DataClusterDialog_1);
serverLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
serverComboViewer = new ComboViewer(firstLine, SWT.DROP_DOWN | SWT.READ_ONLY);
Combo combo = serverComboViewer.getCombo();
GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
data.widthHint = 200;
combo.setLayoutData(data);
serverComboViewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
MDMServerDef serverDef = (MDMServerDef) element;
// $NON-NLS-1$ //$NON-NLS-2$;
return serverDef.getName() + " (" + serverDef.getHost() + ")";
}
});
serverComboViewer.setContentProvider(new ArrayContentProvider());
serverComboViewer.setInput(getAllServerDefs());
Label containerLabel = new Label(firstLine, SWT.NONE);
containerLabel.setText(Messages.DataClusterDialog_2);
containerLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1));
containerComboViewer = new ComboViewer(firstLine, SWT.DROP_DOWN | SWT.READ_ONLY);
Combo containerCombo = containerComboViewer.getCombo();
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
layoutData.widthHint = 200;
containerCombo.setLayoutData(layoutData);
containerComboViewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
TreeObject treeObj = (TreeObject) element;
return treeObj.getName();
}
});
containerComboViewer.setContentProvider(new ArrayContentProvider());
containerComboViewer.setInput(new TreeObject[0]);
containerComboViewer.getCombo().setEnabled(false);
return firstLine;
}
use of com.amalto.workbench.utils.MDMServerDef in project tmdm-studio-se by Talend.
the class DataClusterDialog method getAllDataContainers.
private boolean getAllDataContainers(List<TreeObject> dataContainers) {
MDMServerDef serverDef = getSelectedMdmServerDef();
String username = serverDef.getUser();
String password = serverDef.getPasswd();
String serverName = serverDef.getName();
String endpointaddress = serverDef.getUrl();
boolean canConnect = checkConnection(endpointaddress, username, password);
if (!canConnect) {
MessageDialog.openError(site.getShell(), Messages.DataClusterDialog_7, Messages.DataClusterDialog_8);
return false;
}
List<WSDataClusterPK> xdcPKs = null;
try {
TMDMService service = Util.getMDMService(new URL(endpointaddress), username, password);
TreeParent serverRoot = new TreeParent(serverName, null, TreeObject._SERVER_, endpointaddress, username + ":" + // $NON-NLS-1$//$NON-NLS-2$
(password == null ? "" : password));
// $NON-NLS-1$
xdcPKs = service.getDataClusterPKs(new WSRegexDataClusterPKs("*")).getWsDataClusterPKs();
for (WSDataClusterPK pk : xdcPKs) {
String name = pk.getPk();
if (!("CACHE".equals(name))) {
// $NON-NLS-1$
WSDataCluster wsObject = null;
boolean retriveWSObject = false;
try {
if (retriveWSObject) {
wsObject = service.getDataCluster(new WSGetDataCluster(pk));
}
TreeObject obj = new TreeObject(name, serverRoot, TreeObject.DATA_CLUSTER, pk, wsObject);
dataContainers.add(obj);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
return false;
}
return true;
}
use of com.amalto.workbench.utils.MDMServerDef in project tmdm-studio-se by Talend.
the class DeployOnMDMExportWizardPage method deployJobProcess.
private boolean deployJobProcess(String context, IProgressMonitor monitor) {
// retrieve user, password, host, port from selected server
MDMServerDef server = null;
if (mdmServer == null) {
String selectedSpagoBiEngineName = selectedServer;
List<MDMServerDef> listServerSapgo = com.amalto.workbench.utils.MDMServerHelper.getServers();
for (MDMServerDef serv : listServerSapgo) {
if (selectedSpagoBiEngineName.equals(serv.getName())) {
server = serv;
break;
}
}
} else {
server = getServerDefFromList(mdmServer.getShortDescription());
}
if (null == server) {
setDeploySucceed(false);
return false;
}
String user = server.getUser();
String password = server.getPasswd();
String host = server.getHost();
String port = server.getPort();
// check connection before sending data
monitor.setTaskName(Messages.DeployOnMDMExportWizardPage_checkConnection);
boolean success = checkConnection(server.getUrl(), user, password);
if (!success) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
String msg = Messages.DeployOnMDMExportWizardPage_UnableConnect;
MessageDialog.openError(getContainer().getShell(), Messages.DeployOnMDMExportWizardPage_publishResourceError, msg);
}
});
setDeploySucceed(false);
return false;
}
// modified by xie to fix bug 20084 ,do the multi jobs deployment in one time.
for (JobDeploymentInfo jobInfo : jobInfoList) {
monitor.setTaskName(Messages.bind(Messages.DeployOnMDMExportWizardPage_DeployJobOnServer, jobInfo.getJobLabelName(), server.getName()));
String filename = jobInfo.getDescValue();
String contextPath = Util.getContextPath(server.getPath());
String mdmServerUploadURL = server.getProtocol() + host + ":" + port + contextPath + // $NON-NLS-1$ //$NON-NLS-2$
"/services/uploadFile?deployjob=" + new File(filename).getName() + "&jobpath=" + jobInfo.getJobPath() + "&contextStr=" + // $NON-NLS-1$//$NON-NLS-2$
context;
try {
HttpClientUtil.uploadFileToAppServer(mdmServerUploadURL, filename, user, password);
monitor.worked(W_DEPLOY_PROCESS);
} catch (Exception e) {
log.error(e.getMessage(), e);
Display.getDefault().syncExec(new Runnable() {
public void run() {
MessageDialog.openError(getContainer().getShell(), Messages.DeployOnMDMExportWizardPage_publishResourceError, Messages.DeployOnMDMExportWizardPage_ErrorDeployMsg);
}
});
recordDeployException(new RuntimeException(e.getMessage(), e));
setDeploySucceed(false);
return false;
}
}
mdmServer = toSpagoBiServer(server);
setDeploySucceed(true);
return true;
}
use of com.amalto.workbench.utils.MDMServerDef in project tmdm-studio-se by Talend.
the class DeployOnMDMExportWizardPage method createOptions.
/**
* Create the buttons for the group that determine if the entire or selected directory structure should be created.
*
* @param optionsGroup
* @param font
*/
protected void createOptions(Composite optionsGroup, Font font) {
// create directory structure radios
List<MDMServerDef> listServerSapgo = com.amalto.workbench.utils.MDMServerHelper.getServers();
List<String> listEngine = new ArrayList<String>();
if (mdmServer == null) {
for (MDMServerDef serv : listServerSapgo) {
listEngine.add(serv.getName());
}
serverSpagoBi = new LabelledCombo(optionsGroup, Messages.DeployOnMDMExportWizardPage_SpagoBI_Server, Messages.DeployOnMDMExportWizardPage_SpecifyServer_PublishJob, listEngine);
serverSpagoBi.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateSelectedServer();
}
});
serverSpagoBi.select(0);
}
Composite typeComp = new Composite(optionsGroup, SWT.NONE);
typeComp.setLayout(new FillLayout(SWT.HORIZONTAL));
typeComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
Label typeLabel = new Label(typeComp, SWT.NONE);
typeLabel.setText(Messages.DeployOnMDMExportWizardPage_ExportType);
Label contentLabel = new Label(typeComp, SWT.NONE);
contentLabel.setText(Messages.DeployOnMDMExportWizardPage_hostedZip);
contextButton = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
contextButton.setText(Messages.JobScriptsExportWizardPage_contextPerlScripts);
contextButton.setSelection(true);
contextButton.setFont(font);
contextCombo = new Combo(optionsGroup, SWT.PUSH);
}
Aggregations