Search in sources :

Example 21 with MDMServerDef

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

the class ServerDefService method getLegendServerDefs.

/*
     * (non-Javadoc)
     * 
     * @see com.amalto.workbench.service.ILegendServerDefService#getLegendServerDefs()
     */
public List<com.amalto.workbench.utils.MDMServerDef> getLegendServerDefs() {
    List<MDMServerDef> servers = ServerDefService.getAllServerDefs();
    List<com.amalto.workbench.utils.MDMServerDef> legendDefs = new LinkedList<com.amalto.workbench.utils.MDMServerDef>();
    if (servers != null) {
        for (MDMServerDef serverDef : servers) {
            String url = // $NON-NLS-1$
            serverDef.getProtocol() + serverDef.getHost() + ":" + serverDef.getPort() + serverDef.getPath();
            com.amalto.workbench.utils.MDMServerDef legendDef = com.amalto.workbench.utils.MDMServerDef.parse(serverDef.getProtocol(), url, serverDef.getUser(), serverDef.getPasswd(), serverDef.getName());
            legendDefs.add(legendDef);
        }
    }
    return legendDefs;
}
Also used : MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) LinkedList(java.util.LinkedList)

Example 22 with MDMServerDef

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

the class ShowServerConsoleAction method run.

@Override
public void run() {
    IRepositoryViewObject viewObject = getSelectedViewObject();
    if (viewObject != null) {
        MDMServerDefItem serverDefItem = getMDMItem(viewObject);
        MDMServerDef selectedServerDef = serverDefItem.getServerDef();
        if (selectedServerDef != null) {
            showMDMServerConsole(selectedServerDef);
        }
    }
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 23 with MDMServerDef

use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef 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);
}
Also used : MalformedURLException(java.net.MalformedURLException) MissingJarsException(com.amalto.workbench.service.MissingJarsException) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) XtentisException(com.amalto.workbench.utils.XtentisException)

Example 24 with MDMServerDef

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

the class JobResourceListener method run.

@Override
protected void run(String propertyName, final Item item) throws Exception {
    boolean jobSaved = false;
    boolean jobCreated = false;
    if (propertyName.equals(ERepositoryActionName.SAVE.getName())) {
        jobSaved = true;
    }
    if (propertyName.equals(ERepositoryActionName.CREATE.getName()) || propertyName.equals(ERepositoryActionName.IMPORT.getName()) || propertyName.equals(ERepositoryActionName.COPY.getName())) {
        jobCreated = true;
    }
    if (!jobSaved && !jobCreated) {
        // if the operation is not job saved or created, just don't do anything.
        return;
    }
    if (jobCreated) {
        CommandManager.getInstance().pushCommand(ICommand.CMD_ADD, item.getProperty().getId(), item.getProperty().getDisplayName());
        removeLastServerInfo(item);
    }
    if (jobSaved) {
        // create a new object but without GUI info since it won't be used here certainly
        final IRepositoryViewObject viewObject = new RepositoryViewObject(item.getProperty(), true);
        final MDMServerDef serverDef = RepositoryResourceUtil.getLastServerDef(viewObject);
        DisplayUtils.getDisplay().syncExec(new Runnable() {

            public void run() {
                if (viewObject != null && serverDef != null && isOpenInEditor(viewObject)) {
                    CommandManager.getInstance().pushCommand(ICommand.CMD_MODIFY, viewObject);
                    final IRepositoryViewObject cacheViewObject = ContainerCacheService.get(item.getProperty());
                    if (cacheViewObject != null) {
                        MDMRepositoryView.show().getCommonViewer().refresh(cacheViewObject);
                    } else {
                        MDMRepositoryView.show().getCommonViewer().refresh(viewObject);
                    }
                }
            }
        });
    }
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryViewObject(org.talend.core.model.repository.RepositoryViewObject)

Example 25 with MDMServerDef

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

the class RepositoryViewObjectCheckedWidget method updateServerDef.

private void updateServerDef(IRepositoryViewObject viewObj) {
    if (hasSameServerDef) {
        Item item = viewObj.getProperty().getItem();
        if (item == null || item instanceof ContainerItem) {
            return;
        }
        MDMServerDef serverDef = RepositoryResourceUtil.getLastServerDef(item);
        if (lastServerDef == null) {
            lastServerDef = serverDef;
        } else {
            if (!lastServerDef.equals(serverDef)) {
                lastServerDef = null;
                hasSameServerDef = false;
            }
        }
    }
}
Also used : Item(org.talend.core.model.properties.Item) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) TreeItem(org.eclipse.swt.widgets.TreeItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

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