Search in sources :

Example 6 with MDMServerDef

use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.

the class MDMEventManagerAction method doRun.

@Override
protected void doRun() {
    boolean checkMissingJar = MissingJarService.getInstance().checkMissingJar(true);
    if (!checkMissingJar) {
        return;
    }
    MDMServerDef serverDef = getServerDef();
    if (serverDef != null) {
        try {
            ServerDefService.checkMDMConnection(serverDef);
        } catch (Exception e) {
            MessageDialog.openError(getShell(), Messages.MDMEventManagerAction_CheckConnection, Messages.MDMEventManagerAction_connectFailed);
            return;
        }
        IRepositoryViewObject eventViewObj = getEventMangerViewObject();
        TreeObject treeObj = createModel();
        XObjectBrowserInput2 input = new XObjectBrowserInput2(eventViewObj, treeObj, Messages.EventManager_text);
        input.setServerDef(serverDef);
        if (page == null) {
            this.page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        }
        try {
            this.page.openEditor(input, XObjectBrowser2.EDITOR_ID);
        } catch (PartInitException e) {
            log.error(e.getMessage(), e);
        }
        setServerDef(null);
    }
}
Also used : XObjectBrowserInput2(org.talend.mdm.repository.ui.editors.XObjectBrowserInput2) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TreeObject(com.amalto.workbench.models.TreeObject) PartInitException(org.eclipse.ui.PartInitException) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) PartInitException(org.eclipse.ui.PartInitException)

Example 7 with MDMServerDef

use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.

the class TestTriggerAction method openServerDialog.

public MDMServerDef openServerDialog(MDMServerDef serverObject) {
    SelectServerDefDialog dlg = new SelectServerDefDialog(getShell());
    dlg.create();
    dlg.setSelectServer(serverObject);
    if (dlg.open() == IDialogConstants.OK_ID) {
        MDMServerDef serverDef = dlg.getSelectedServerDef();
        return serverDef;
    }
    return null;
}
Also used : SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 8 with MDMServerDef

use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.

the class UndeployAction method getServerDefDialog.

private SelectServerDefDialog getServerDefDialog(List<IRepositoryViewObject> viewObjs) {
    SelectServerDefDialog dialog = new SelectServerDefDialog(getShell());
    MDMServerDef defServer = null;
    for (IRepositoryViewObject viewObject : viewObjs) {
        MDMServerDef tmpServer = RepositoryResourceUtil.getLastServerDef(viewObject);
        if (defServer == null) {
            defServer = tmpServer;
        } else if (tmpServer != null && !RepositoryResourceUtil.isSameMDMServerDef(defServer, tmpServer)) {
            defServer = null;
            break;
        }
    }
    dialog.create();
    dialog.setSelectServer(defServer);
    return dialog;
}
Also used : SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 9 with MDMServerDef

use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.

the class ExportDataClusterAction method doRun.

@Override
protected void doRun() {
    List<Object> selectedObject = getSelectedObject();
    if (!selectedObject.isEmpty()) {
        IRepositoryViewObject viewObj = (IRepositoryViewObject) selectedObject.get(0);
        SelectServerDefDialog dialog = new SelectServerDefDialog(getShell());
        if (dialog.open() == IDialogConstants.OK_ID) {
            MDMServerDef serverDef = dialog.getSelectedServerDef();
            MDMServerObjectItem item = (MDMServerObjectItem) viewObj.getProperty().getItem();
            String dName = item.getMDMServerObject().getName();
            try {
                FileDialog fd = new FileDialog(getShell(), SWT.SAVE);
                // $NON-NLS-1$
                fd.setFilterExtensions(new String[] { "*.zip" });
                String fPath = fd.open();
                if (fPath != null) {
                    TMDMService service = RepositoryWebServiceAdapter.getMDMService(serverDef);
                    service.ping(new WSPing(Messages.ExportDataClusterAction_exportContent));
                    DataClusterService dataClusterService = DataClusterService.getIntance();
                    if (dataClusterService.isExistDataCluster(service, dName)) {
                        File tempFolder = IOUtil.getTempFolder();
                        String tempFolderPath = tempFolder.getAbsolutePath();
                        dataClusterService.storeIndexFile(tempFolderPath, dName);
                        // 
                        IDataContentProcess process = dataClusterService.getNewExportContentProcess(service, tempFolderPath, dName, fPath);
                        try {
                            process.run();
                        } catch (InterruptedException e) {
                            // do nothing
                            return;
                        }
                        MultiStatus status = process.getResult();
                        if (status != null && status.getChildren().length > 0) {
                            MessageDialog.openError(getShell(), Messages._Error, Messages.bind(Messages.ExportDataClusterAction_failedExportContent, dName));
                        } else {
                            MessageDialog.openInformation(getShell(), Messages.ExportDataClusterAction_exportContent, Messages.bind(Messages.ExportDataClusterAction_successExport, dName));
                        }
                    } else {
                        MessageDialog.openInformation(getShell(), Messages.Common_Warning, Messages.bind(Messages.ExportDataClusterAction_noContainerFound, dName));
                    }
                }
            } catch (XtentisException e) {
                log.error(e.getMessage(), e);
            } catch (WebServiceException e) {
                MessageDialog.openError(getShell(), Messages.ExportDataClusterAction_exportContent, Messages.AbstractDataClusterAction_ConnectFailed);
            }
        }
    }
}
Also used : WSPing(com.amalto.workbench.webservices.WSPing) DataClusterService(org.talend.mdm.repository.core.service.DataClusterService) WebServiceException(javax.xml.ws.WebServiceException) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) IDataContentProcess(org.talend.mdm.repository.core.datacontent.IDataContentProcess) MultiStatus(org.eclipse.core.runtime.MultiStatus) TMDMService(com.amalto.workbench.webservices.TMDMService) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) FileDialog(org.eclipse.swt.widgets.FileDialog) File(java.io.File) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) XtentisException(com.amalto.workbench.utils.XtentisException)

Example 10 with MDMServerDef

use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.

the class ImportDataClusterAction method doRun.

@Override
protected void doRun() {
    FileDialog fd = new FileDialog(getShell(), SWT.OPEN);
    // $NON-NLS-1$
    fd.setFilterExtensions(new String[] { "*.zip" });
    String fPath = fd.open();
    if (fPath != null) {
        DataClusterService dataClusterService = DataClusterService.getIntance();
        File tempFolder = IOUtil.getTempFolder();
        String tempFolderPath = tempFolder.getAbsolutePath();
        dataClusterService.unZipFile(fPath, tempFolderPath);
        String dName = dataClusterService.loadIndexFile(tempFolderPath);
        if (dName == null) {
            MessageDialog.openError(getShell(), Messages.Common_Error, Messages.ImportDataClusterAction_errorFormat);
            return;
        }
        tempFolderPath += File.separator + dName;
        // 
        SelectServerDefDialog dialog = new SelectServerDefDialog(getShell());
        if (dialog.open() == IDialogConstants.OK_ID) {
            MDMServerDef serverDef = dialog.getSelectedServerDef();
            try {
                TMDMService service = RepositoryWebServiceAdapter.getMDMService(serverDef);
                service.ping(new WSPing(Messages.ImportDataClusterAction_importTitle));
                if (!dataClusterService.isExistDataCluster(service, dName)) {
                    if (MessageDialog.openQuestion(getShell(), Messages.ImportDataClusterAction_createDataClusterTitle, Messages.bind(Messages.ImportDataClusterAction_createConfirm, dName))) {
                        dataClusterService.createDataCluster(service, dName);
                    } else {
                        return;
                    }
                }
                IDataContentProcess process = dataClusterService.getNewImportContentProcess(serverDef, dName, tempFolderPath);
                try {
                    process.run();
                } catch (InterruptedException e) {
                    // do nothing
                    return;
                }
                MultiStatus multiStatus = process.getResult();
                if (multiStatus != null && multiStatus.getChildren().length > 0) {
                    MultiStatusDialog statusDialog = new MultiStatusDialog(getShell(), multiStatus.getMessage(), multiStatus);
                    statusDialog.open();
                } else {
                    // show success info
                    MessageDialog.openInformation(getShell(), Messages.ImportDataClusterAction_importTitle, Messages.bind(Messages.ImportDataClusterAction_successImport, dName));
                }
            } catch (XtentisException e) {
                log.error(e.getMessage(), e);
            } catch (WebServiceException e) {
                MessageDialog.openError(getShell(), Messages.ImportDataClusterAction_importTitle, Messages.AbstractDataClusterAction_ConnectFailed);
            } finally {
                IOUtil.cleanFolder(tempFolder);
            }
        }
    }
}
Also used : WSPing(com.amalto.workbench.webservices.WSPing) DataClusterService(org.talend.mdm.repository.core.service.DataClusterService) WebServiceException(javax.xml.ws.WebServiceException) IDataContentProcess(org.talend.mdm.repository.core.datacontent.IDataContentProcess) MultiStatusDialog(org.talend.mdm.repository.ui.dialogs.message.MultiStatusDialog) MultiStatus(org.eclipse.core.runtime.MultiStatus) TMDMService(com.amalto.workbench.webservices.TMDMService) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) FileDialog(org.eclipse.swt.widgets.FileDialog) File(java.io.File) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) XtentisException(com.amalto.workbench.utils.XtentisException)

Aggregations

MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)66 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)36 SelectServerDefDialog (org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog)15 Item (org.talend.core.model.properties.Item)11 MDMServerDefItem (org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem)10 MDMServerObjectItem (org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem)10 IStatus (org.eclipse.core.runtime.IStatus)8 MDMServerObject (org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)8 PersistenceException (org.talend.commons.exception.PersistenceException)7 AbstractDeployCommand (org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand)7 TMDMService (com.amalto.workbench.webservices.TMDMService)6 CommandManager (org.talend.mdm.repository.core.command.CommandManager)6 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)6 TreeObject (com.amalto.workbench.models.TreeObject)5 XtentisException (com.amalto.workbench.utils.XtentisException)5 ArrayList (java.util.ArrayList)5 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 Test (org.junit.Test)5 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 LinkedList (java.util.LinkedList)4