Search in sources :

Example 6 with ProjectUpdater

use of com.centurylink.mdw.plugin.project.assembly.ProjectUpdater in project mdw-designer by CenturyLinkCloud.

the class TomcatServerBehavior method publishModules.

/**
 * Only overridden to set the monitor ticks.
 */
@SuppressWarnings("rawtypes")
@Override
protected void publishModules(int kind, List modules, List deltaKind2, MultiStatus multi, IProgressMonitor monitor) {
    if (modules == null)
        return;
    int size = modules.size();
    if (size == 0)
        return;
    // publish modules
    for (int i = 0; i < size; i++) {
        if (monitor.isCanceled())
            return;
        // should skip this publish
        IModule[] module = (IModule[]) modules.get(i);
        IModule m = module[module.length - 1];
        if (shouldIgnorePublishRequest(m))
            continue;
        int kind2 = kind;
        if (getServer().getModulePublishState(module) == IServer.PUBLISH_STATE_UNKNOWN)
            kind2 = IServer.PUBLISH_FULL;
        // for workflow client apps, download if mdw.war not found
        if (getWebProject() == null && module[0].getProject() != null) {
            WorkflowProject clientWf = WorkflowProjectManager.getInstance().getWorkflowProject(module[0].getProject());
            if (clientWf != null) {
                String deployLoc = getServer().getAttribute(ITomcatServer.PROPERTY_INSTANCE_DIR, clientWf.getDeployFolder().getLocation().toPortableString());
                File mdwWar = new File(deployLoc + "/webapps/mdw.war");
                if (kind == IServer.PUBLISH_CLEAN && mdwWar.exists() && !mdwWar.delete())
                    showError("Publish Error", "Unable to delete " + mdwWar, clientWf);
                if (!mdwWar.exists()) {
                    ProjectUpdater updater = new ProjectUpdater(getProject(), MdwPlugin.getSettings());
                    try {
                        updater.updateFrameworkJars(new SubProgressMonitor(monitor, 1));
                    } catch (Exception ex) {
                        showError(ex.getMessage(), "Update Framework Libraries", clientWf);
                    }
                }
            }
        }
        IStatus status;
        if (getWebProject() != null && kind == IServer.PUBLISH_CLEAN || ((Integer) deltaKind2.get(i)).intValue() == ServerBehaviourDelegate.REMOVED)
            status = publishModule(kind2, module, ((Integer) deltaKind2.get(i)).intValue(), ProgressUtil.getSubMonitorFor(monitor, size * 3000));
        else
            status = publishModule(kind2, module, ((Integer) deltaKind2.get(i)).intValue(), ProgressUtil.getSubMonitorFor(monitor, 3000));
        if (status != null && !status.isOK())
            multi.add(status);
    }
}
Also used : IModule(org.eclipse.wst.server.core.IModule) IStatus(org.eclipse.core.runtime.IStatus) ProjectUpdater(com.centurylink.mdw.plugin.project.assembly.ProjectUpdater) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) JarFile(java.util.jar.JarFile) OsgiBuildFile(com.centurylink.mdw.plugin.project.model.OsgiBuildFile) MavenBuildFile(com.centurylink.mdw.plugin.project.model.MavenBuildFile) GradleBuildFile(com.centurylink.mdw.plugin.project.model.GradleBuildFile) File(java.io.File) SubProgressMonitor(org.eclipse.core.runtime.SubProgressMonitor) CoreException(org.eclipse.core.runtime.CoreException) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) IOException(java.io.IOException)

Example 7 with ProjectUpdater

use of com.centurylink.mdw.plugin.project.assembly.ProjectUpdater in project mdw-designer by CenturyLinkCloud.

the class AdminUi method addTo.

public boolean addTo(WorkflowProject project, IProgressMonitor monitor) throws ExtensionModuleException, InterruptedException {
    monitor.worked(5);
    try {
        ProjectUpdater updater = new ProjectUpdater(project, MdwPlugin.getSettings()) {

            protected URL getFileUrl() throws IOException {
                return super.getRepositoryFileUrl("mdw-admin", getVersion());
            }
        };
        updater.addWarLib("mdw-admin-" + getVersion() + ".war", "mdw-admin.war", new SubProgressMonitor(monitor, 90));
        monitor.worked(5);
    } catch (InterruptedException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new ExtensionModuleException(ex.getMessage(), ex);
    }
    return true;
}
Also used : ProjectUpdater(com.centurylink.mdw.plugin.project.assembly.ProjectUpdater) SubProgressMonitor(org.eclipse.core.runtime.SubProgressMonitor) IOException(java.io.IOException)

Example 8 with ProjectUpdater

use of com.centurylink.mdw.plugin.project.assembly.ProjectUpdater in project mdw-designer by CenturyLinkCloud.

the class AdminUi method update.

public boolean update(WorkflowProject project, IProgressMonitor monitor) throws ExtensionModuleException, InterruptedException {
    monitor.worked(5);
    try {
        ProjectUpdater updater = new ProjectUpdater(project, MdwPlugin.getSettings()) {

            protected URL getFileUrl() throws IOException {
                return super.getRepositoryFileUrl("mdw-admin", getVersion());
            }
        };
        updater.addWarLib("mdw-admin-" + getVersion() + ".war", "mdw-admin.war", new SubProgressMonitor(monitor, 90));
        monitor.worked(5);
    } catch (InterruptedException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new ExtensionModuleException(ex.getMessage(), ex);
    }
    return true;
}
Also used : ProjectUpdater(com.centurylink.mdw.plugin.project.assembly.ProjectUpdater) SubProgressMonitor(org.eclipse.core.runtime.SubProgressMonitor) IOException(java.io.IOException)

Example 9 with ProjectUpdater

use of com.centurylink.mdw.plugin.project.assembly.ProjectUpdater in project mdw-designer by CenturyLinkCloud.

the class LibExtension method addTo.

@Override
public boolean addTo(WorkflowProject project, IProgressMonitor monitor) throws ExtensionModuleException, InterruptedException {
    monitor.worked(5);
    try {
        ProjectUpdater updater = new ProjectUpdater(project, MdwPlugin.getSettings());
        updater.addAppLibs(getZipFile(project), new SubProgressMonitor(monitor, 90));
        monitor.worked(5);
    } catch (InterruptedException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new ExtensionModuleException(ex.getMessage(), ex);
    }
    return true;
}
Also used : ProjectUpdater(com.centurylink.mdw.plugin.project.assembly.ProjectUpdater) SubProgressMonitor(org.eclipse.core.runtime.SubProgressMonitor)

Example 10 with ProjectUpdater

use of com.centurylink.mdw.plugin.project.assembly.ProjectUpdater in project mdw-designer by CenturyLinkCloud.

the class LibExtension method removeFrom.

@Override
public boolean removeFrom(WorkflowProject project, IProgressMonitor monitor) throws ExtensionModuleException, InterruptedException {
    monitor.worked(5);
    try {
        ProjectUpdater updater = new ProjectUpdater(project, MdwPlugin.getSettings());
        updater.removeAppLibs(getZipFile(project), new SubProgressMonitor(monitor, 90));
        monitor.worked(5);
    } catch (InterruptedException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new ExtensionModuleException(ex.getMessage(), ex);
    }
    return true;
}
Also used : ProjectUpdater(com.centurylink.mdw.plugin.project.assembly.ProjectUpdater) SubProgressMonitor(org.eclipse.core.runtime.SubProgressMonitor)

Aggregations

ProjectUpdater (com.centurylink.mdw.plugin.project.assembly.ProjectUpdater)16 SubProgressMonitor (org.eclipse.core.runtime.SubProgressMonitor)11 IOException (java.io.IOException)7 CoreException (org.eclipse.core.runtime.CoreException)7 IProject (org.eclipse.core.resources.IProject)4 ExtensionModulesUpdater (com.centurylink.mdw.plugin.project.assembly.ExtensionModulesUpdater)3 ProjectConfigurator (com.centurylink.mdw.plugin.project.assembly.ProjectConfigurator)3 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)3 MdwProgressMonitorDialog (com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 XmlException (org.apache.xmlbeans.XmlException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)2 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 PropertyEditor (com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)1 ValueChangeListener (com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener)1 MdwSettings (com.centurylink.mdw.plugin.preferences.model.MdwSettings)1 ProjectInflator (com.centurylink.mdw.plugin.project.assembly.ProjectInflator)1 GradleBuildFile (com.centurylink.mdw.plugin.project.model.GradleBuildFile)1