Search in sources :

Example 16 with ServerSettings

use of com.centurylink.mdw.plugin.project.model.ServerSettings in project mdw-designer by CenturyLinkCloud.

the class WorkflowElementActionHandler method debug.

public void debug(Object element) {
    if (element instanceof WorkflowProcess) {
        WorkflowProcess processVersion = (WorkflowProcess) element;
        IEditorPart editorPart = findOpenEditor(processVersion);
        if (editorPart != null && editorPart.isDirty()) {
            if (MessageDialog.openQuestion(getShell(), "Process Launch", "Save process '" + processVersion.getLabel() + "' before launching?"))
                editorPart.doSave(new NullProgressMonitor());
        }
        if (editorPart == null) {
            // process must be open
            open(processVersion);
        }
        ProcessLaunchShortcut launchShortcut = new ProcessLaunchShortcut();
        launchShortcut.launch(new StructuredSelection(processVersion), ILaunchManager.DEBUG_MODE);
    } else if (element instanceof Activity) {
        Activity activity = (Activity) element;
        WorkflowProcess processVersion = activity.getProcess();
        IEditorPart editorPart = findOpenEditor(processVersion);
        if (editorPart != null && editorPart.isDirty()) {
            if (MessageDialog.openQuestion(getShell(), "Activity Launch", "Save process '" + processVersion.getLabel() + "' before launching?"))
                editorPart.doSave(new NullProgressMonitor());
        }
        ActivityLaunchShortcut launchShortcut = new ActivityLaunchShortcut();
        launchShortcut.launch(new StructuredSelection(activity), ILaunchManager.DEBUG_MODE);
    } else if (element instanceof ExternalEvent) {
        ExternalEvent externalEvent = (ExternalEvent) element;
        ExternalEventLaunchShortcut launchShortcut = new ExternalEventLaunchShortcut();
        launchShortcut.launch(new StructuredSelection(externalEvent), ILaunchManager.DEBUG_MODE);
    } else if (element instanceof WorkflowProject || element instanceof ServerSettings) {
        ServerSettings serverSettings;
        if (element instanceof WorkflowProject) {
            WorkflowProject workflowProject = (WorkflowProject) element;
            serverSettings = workflowProject.getServerSettings();
        } else {
            serverSettings = (ServerSettings) element;
        }
        serverSettings.setDebug(true);
        if (serverSettings.getDebugPort() == 0)
            serverSettings.setDebugPort(8500);
        run(serverSettings);
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ProcessLaunchShortcut(com.centurylink.mdw.plugin.launch.ProcessLaunchShortcut) ServerSettings(com.centurylink.mdw.plugin.project.model.ServerSettings) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ExternalEventLaunchShortcut(com.centurylink.mdw.plugin.launch.ExternalEventLaunchShortcut) AdapterActivity(com.centurylink.mdw.plugin.designer.model.Activity.AdapterActivity) EvaluatorActivity(com.centurylink.mdw.plugin.designer.model.Activity.EvaluatorActivity) StartActivity(com.centurylink.mdw.plugin.designer.model.Activity.StartActivity) Activity(com.centurylink.mdw.plugin.designer.model.Activity) ActivityLaunchShortcut(com.centurylink.mdw.plugin.launch.ActivityLaunchShortcut) ExternalEvent(com.centurylink.mdw.plugin.designer.model.ExternalEvent) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IEditorPart(org.eclipse.ui.IEditorPart) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 17 with ServerSettings

use of com.centurylink.mdw.plugin.project.model.ServerSettings in project mdw-designer by CenturyLinkCloud.

the class ProjectPersist method saveProjectPrefs.

/**
 * Preferences may be local to a particular user, so save with workspace
 * prefs
 */
public void saveProjectPrefs(IProject project) {
    ServerSettings serverSettings = workflowProject.getServerSettings();
    try {
        setPersistentProperty(project, MDW_SERVER_HOME, serverSettings.getHome());
        setPersistentProperty(project, MDW_SERVER_JDK_HOME, serverSettings.getJdkHome());
        setPersistentProperty(project, MDW_SERVER_LOCATION, serverSettings.getServerLoc());
        int cmdPort = serverSettings.getCommandPort();
        if (cmdPort != 0)
            setPersistentProperty(project, MDW_SERVER_CMD_PORT, String.valueOf(cmdPort));
        String user = serverSettings.getUser();
        setPersistentProperty(project, MDW_SERVER_USER, user);
        if (user != null) {
            String password = serverSettings.getPassword();
            if (password != null) {
                try {
                    setPersistentProperty(project, MDW_SERVER_PASSWORD, CryptUtil.encrypt(password));
                } catch (GeneralSecurityException ex) {
                    PluginMessages.log(ex);
                }
            }
        }
        if (!workflowProject.isRemote()) {
            // default prefs for server type
            setPersistentProperty(MDW_SERVER_TYPE, serverSettings.getContainerType().toString());
            setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_HOME, serverSettings.getHome());
            setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_JDK_HOME, serverSettings.getJdkHome());
            setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_HOST, serverSettings.getHost());
            setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_PORT, String.valueOf(serverSettings.getPort() == 0 ? "" : serverSettings.getPort()));
            setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_CMD_PORT, String.valueOf(serverSettings.getCommandPort() == 0 ? "" : serverSettings.getCommandPort()));
            setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_USER, serverSettings.getUser());
            setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_VERSION, serverSettings.getContainerVersion());
            if (workflowProject.getPersistType() == PersistType.Git) {
                VcsRepository vcsRepo = workflowProject.getMdwVcsRepository();
                setPersistentProperty("MDW" + workflowProject.getMdwVersion() + "-" + MDW_VCS_GIT, vcsRepo.getProvider());
                setPersistentProperty("MDW" + workflowProject.getMdwVersion() + "-" + MDW_VCS_REPO_URL, vcsRepo.getRepositoryUrl());
                setPersistentProperty("MDW" + workflowProject.getMdwVersion() + "-" + MDW_VCS_USER, vcsRepo.getUser());
            }
            JdbcDataSource dataSource = workflowProject.getMdwDataSource();
            setPersistentProperty("MDW" + workflowProject.getMdwVersion() + "-" + MDW_DB_DRIVER, dataSource.getDriver());
            setPersistentProperty("MDW" + workflowProject.getMdwVersion() + "-" + MDW_DB_URL, dataSource.getJdbcUrl());
            setPersistentProperty("MDW" + workflowProject.getMdwVersion() + "-" + MDW_DB_USER, dataSource.getDbUser());
            setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_JAVA_OPTS, serverSettings.getJavaOptions());
        }
        if (serverSettings.isDebug()) {
            setPersistentProperty(project, MDW_SERVER_DEBUG, "true");
            setPersistentProperty(project, MDW_SERVER_DEBUG_PORT, String.valueOf(serverSettings.getDebugPort()));
            setPersistentProperty(project, MDW_SERVER_SUSPEND, String.valueOf(serverSettings.isSuspend()));
        } else {
            setPersistentProperty(project, MDW_SERVER_DEBUG, null);
        }
        setPersistentProperty(project, LOG_WATCHER_PORT, String.valueOf(serverSettings.getLogWatcherPort()));
        setPersistentProperty(project, LOG_WATCHER_TIMEOUT, String.valueOf(serverSettings.getLogWatcherTimeout()));
        setPersistentProperty(project, STUB_SERVER_PORT, String.valueOf(serverSettings.getStubServerPort()));
        setPersistentProperty(project, STUB_SERVER_TIMEOUT, String.valueOf(serverSettings.getStubServerTimeout()));
        if (workflowProject.getPersistType() == PersistType.Git) {
            setPersistentProperty(project, MDW_VCS_SYNC_ARCHIVE, String.valueOf(workflowProject.getMdwVcsRepository().isSyncAssetArchive()));
        }
        setPersistentProperty(project, MDW_UPDATE_SERVER_CACHE, String.valueOf(workflowProject.isUpdateServerCache()));
    } catch (CoreException ex) {
        PluginMessages.log(ex);
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) ServerSettings(com.centurylink.mdw.plugin.project.model.ServerSettings) GeneralSecurityException(java.security.GeneralSecurityException) JdbcDataSource(com.centurylink.mdw.plugin.project.model.JdbcDataSource) VcsRepository(com.centurylink.mdw.plugin.project.model.VcsRepository)

Example 18 with ServerSettings

use of com.centurylink.mdw.plugin.project.model.ServerSettings in project mdw-designer by CenturyLinkCloud.

the class ServerPropertyPage method createContents.

@Override
protected Control createContents(Composite parent) {
    noDefaultAndApplyButton();
    initializeWorkflowProject();
    workingCopy = new ServerSettings(getProject().getServerSettings());
    Composite composite = createComposite(parent);
    if (!workingCopy.isOsgi()) {
        createServerRunnerControls(composite);
        addSeparator(composite);
    }
    createLogWatcherControls(composite);
    addSeparator(composite);
    createStubServerControls(composite);
    return composite;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ServerSettings(com.centurylink.mdw.plugin.project.model.ServerSettings)

Example 19 with ServerSettings

use of com.centurylink.mdw.plugin.project.model.ServerSettings in project mdw-designer by CenturyLinkCloud.

the class TomcatSettingsPage method serverLocSpecializedCheck.

protected String serverLocSpecializedCheck(String serverLoc) {
    ServerSettings serverSettings = getProject().getServerSettings();
    serverSettings.setServerLoc(serverSettings.getHome());
    return null;
}
Also used : ServerSettings(com.centurylink.mdw.plugin.project.model.ServerSettings)

Aggregations

ServerSettings (com.centurylink.mdw.plugin.project.model.ServerSettings)19 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)7 JdbcDataSource (com.centurylink.mdw.plugin.project.model.JdbcDataSource)3 Activity (com.centurylink.mdw.plugin.designer.model.Activity)2 AdapterActivity (com.centurylink.mdw.plugin.designer.model.Activity.AdapterActivity)2 EvaluatorActivity (com.centurylink.mdw.plugin.designer.model.Activity.EvaluatorActivity)2 StartActivity (com.centurylink.mdw.plugin.designer.model.Activity.StartActivity)2 ExternalEvent (com.centurylink.mdw.plugin.designer.model.ExternalEvent)2 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)2 ActivityLaunchShortcut (com.centurylink.mdw.plugin.launch.ActivityLaunchShortcut)2 ExternalEventLaunchShortcut (com.centurylink.mdw.plugin.launch.ExternalEventLaunchShortcut)2 ProcessLaunchShortcut (com.centurylink.mdw.plugin.launch.ProcessLaunchShortcut)2 VcsRepository (com.centurylink.mdw.plugin.project.model.VcsRepository)2 ServerConfigurator (com.centurylink.mdw.plugin.server.ServerConfigurator)2 ServerRunner (com.centurylink.mdw.plugin.server.ServerRunner)2 GeneralSecurityException (java.security.GeneralSecurityException)2 IStatus (org.eclipse.core.runtime.IStatus)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 Status (org.eclipse.core.runtime.Status)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2