You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by mc...@apache.org on 2009/07/25 11:42:50 UTC

svn commit: r797733 - in /geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins: org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/ org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/commands/ org.apache.geronimo.st...

Author: mcconne
Date: Sat Jul 25 09:42:49 2009
New Revision: 797733

URL: http://svn.apache.org/viewvc?rev=797733&view=rev
Log:
GERONIMODEVTOOLS-580 No redeployment required when only JSP files are modified -- Thanks to Delos Dai for this patch !!

Added:
    geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/commands/SetNotRedeployJSPFilesCommand.java   (with props)
Modified:
    geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/DeploymentUtils.java
    geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
    geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerDelegate.java
    geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/IGeronimoServer.java
    geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
    geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
    geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/ServerEditorTestEnvSection.java
    geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServer.java

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/DeploymentUtils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/DeploymentUtils.java?rev=797733&r1=797732&r2=797733&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/DeploymentUtils.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/DeploymentUtils.java Sat Jul 25 09:42:49 2009
@@ -17,6 +17,8 @@
 package org.apache.geronimo.st.core;
 
 import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
 
 import javax.enterprise.deploy.spi.DeploymentManager;
 import javax.enterprise.deploy.spi.TargetModuleID;
@@ -47,6 +49,9 @@
 import org.eclipse.wst.server.core.IServer;
 import org.eclipse.wst.server.core.model.IModuleResource;
 import org.eclipse.wst.server.core.util.ProjectModule;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleFolder;
 
 /**
  * @version $Rev$ $Date$
@@ -225,5 +230,28 @@
 		
 		return null;
 	}
+    
+    
+    public static List<IModuleResourceDelta> getAffectedJSPFiles(IModuleResourceDelta delta) {
+        if (delta == null) return null;
+
+        IModuleResource resource = delta.getModuleResource();
+        List<IModuleResourceDelta> fileList = new ArrayList<IModuleResourceDelta>();
+
+        if (resource instanceof IModuleFile) {
+            IModuleFile moduleFile = (IModuleFile)resource;
+            if (moduleFile.getName().endsWith(".jsp")) {
+                fileList.add(delta);
+            }
+            else return null;   //not only jsp changed
+        }
+        else if (resource instanceof IModuleFolder) {
+            IModuleResourceDelta[] deltaArray = delta.getAffectedChildren();
+            for (IModuleResourceDelta childDelta: deltaArray) {
+                fileList.addAll(getAffectedJSPFiles(childDelta));
+            }
+        }
 
+        return fileList;
+    }
 }

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java?rev=797733&r1=797732&r2=797733&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java Sat Jul 25 09:42:49 2009
@@ -16,8 +16,16 @@
  */
 package org.apache.geronimo.st.core;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -73,6 +81,8 @@
 import org.eclipse.wst.server.core.ServerEvent;
 import org.eclipse.wst.server.core.ServerPort;
 import org.eclipse.wst.server.core.internal.ProgressUtil;
+import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
 import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
 import org.eclipse.wst.server.core.util.SocketUtil;
 
@@ -300,10 +310,11 @@
             //NO_CHANGE need if app is associated but not started and no delta
             if (deltaKind == NO_CHANGE && module.length == 1) {
                 invokeCommand(deltaKind, module[0]);
-            } else if (deltaKind == CHANGED || deltaKind == ADDED || deltaKind == REMOVED) {
+            }
+            else if (deltaKind == CHANGED || deltaKind == ADDED || deltaKind == REMOVED) {
                 invokeCommand(deltaKind, module[0]);
-            } 
-        } 
+            }
+        }
         catch (CoreException e) {
             //
             // Set the module publish state to UNKNOWN so that WTP will not display "Synchronized"
@@ -501,6 +512,14 @@
         if(configId != null) {
             String moduleConfigId = getConfigId(module);
             if(moduleConfigId.equals(configId)) {
+                
+                if (this.getServerDelegate().isNotRedeployJSPFiles()&&!this.isRemote() && GeronimoUtils.isWebModule(module)
+                        && !module.isExternal()) {
+                    // if only jsp files changed, no redeploy needed
+                    if (findAndReplaceJspFiles(module, configId))
+                        return;
+                }
+                
                 IStatus status = reDeploy(module);
                 if (!status.isOK()) {
                     doFail(status, Messages.REDEPLOY_FAIL);
@@ -518,6 +537,119 @@
         Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.doChanged");
     }
 
+    
+    
+    /*
+     * This method is used to replace updated JSP files without deploy it. 
+     */
+    private boolean findAndReplaceJspFiles(IModule module, String configId)
+            throws CoreException {
+        IModule[] modules = { module };
+        IModuleResourceDelta[] deltaArray = this
+                .getPublishedResourceDelta(modules);
+
+        // get repository position
+        String ch = File.separator;
+        String repositoryLocation = this.getRuntimeDelegate().getRuntime()
+                .getLocation().toOSString()
+                + ch + "repository" + ch;
+        // Suppose directory structure of deployed module is
+        // "repository/[groupID]/[artifactId]/[version]/[artifactId]-[version].[artifactType]"
+        // configId contains the groupID,artifactId,version,artifactType
+        String[] segments = configId.split("/");
+        // groupId may contains "." as separator
+        String groupId = null;
+        if (segments[0]!=null)
+            groupId=segments[0].replace(".", "/");
+        String moduleTargetPath = repositoryLocation.concat(groupId)
+                        .concat(ch).concat(segments[1]).concat(ch).concat(segments[2])
+                        .concat(ch).concat(segments[1]).concat("-").concat(segments[2])
+                        .concat(".").concat(segments[3]);
+
+        List<IModuleResourceDelta> jspFiles = new ArrayList<IModuleResourceDelta>();
+        for (IModuleResourceDelta delta : deltaArray) {
+            List<IModuleResourceDelta> partJspFiles= DeploymentUtils
+                    .getAffectedJSPFiles(delta);
+            //if not only Jsp files found, need to redeploy the module, so return false;
+            if (partJspFiles == null) return false;
+            else jspFiles.addAll(partJspFiles);
+        }
+            for (IModuleResourceDelta deltaModule : jspFiles) {
+                IModuleFile moduleFile = (IModuleFile) deltaModule
+                        .getModuleResource();
+
+                String target;
+                String relativePath = moduleFile.getModuleRelativePath()
+                        .toOSString();
+                if (relativePath != null && relativePath.length() != 0) {
+                    target = moduleTargetPath.concat(ch).concat(relativePath)
+                            .concat(ch).concat(moduleFile.getName());
+                } else
+                    target = moduleTargetPath.concat(ch).concat(
+                            moduleFile.getName());
+
+                File file = new File(target);
+                switch (deltaModule.getKind()) {
+                case IModuleResourceDelta.REMOVED:
+                    if (file.exists())
+                        file.delete();
+                    break;
+                case IModuleResourceDelta.ADDED:
+                case IModuleResourceDelta.CHANGED:
+                    if (!file.exists())
+                        try {
+                            file.createNewFile();
+                        } catch (IOException e) {
+                            Trace.trace(Trace.SEVERE, "can't create file "
+                                    + file, e);
+                            throw new CoreException(new Status(IStatus.ERROR,
+                                    Activator.PLUGIN_ID, "can't create file "
+                                            + file, e));
+                        }
+
+                    String rootFolder = GeronimoUtils.getVirtualComponent(
+                            module).getRootFolder().getProjectRelativePath()
+                            .toOSString();
+                    String sourceFile = module.getProject().getFile(
+                            rootFolder + ch
+                                    + moduleFile.getModuleRelativePath() + ch
+                                    + moduleFile.getName()).getLocation()
+                            .toString();
+                    try {
+
+                        FileInputStream in = new FileInputStream(sourceFile);
+                        FileOutputStream out = new FileOutputStream(file);
+                        FileChannel inChannel = in.getChannel();
+                        FileChannel outChannel = out.getChannel();
+                        MappedByteBuffer mappedBuffer = inChannel.map(
+                                FileChannel.MapMode.READ_ONLY, 0, inChannel
+                                        .size());
+                        outChannel.write(mappedBuffer);
+
+                        inChannel.close();
+                        outChannel.close();
+                    } catch (FileNotFoundException e) {
+                        Trace.trace(Trace.SEVERE, "can't find file "
+                                + sourceFile, e);
+                        throw new CoreException(new Status(IStatus.ERROR,
+                                Activator.PLUGIN_ID, "can't find file "
+                                        + sourceFile, e));
+                    } catch (IOException e) {
+                        Trace.trace(Trace.SEVERE, "can't copy file "
+                                + sourceFile, e);
+                        throw new CoreException(new Status(IStatus.ERROR,
+                                Activator.PLUGIN_ID, "can't copy file "
+                                        + sourceFile, e));
+                    }
+                    break;
+                }
+            }
+
+        return true;
+
+    }
+
+
     private String getLastKnowConfigurationId(IModule module, String configId) throws CoreException {
         Trace.tracePoint("Entry ", "GeronimoServerBehaviourDelegate.getLastKnowConfigurationId", module.getName(), configId);
 

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerDelegate.java?rev=797733&r1=797732&r2=797733&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerDelegate.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerDelegate.java Sat Jul 25 09:42:49 2009
@@ -70,7 +70,9 @@
 	public static final String PROPERTY_PUBLISH_TIMEOUT = "publishTimeout";
 	
 	public static final String PROPERTY_IN_PLACE_SHARED_LIB = "inPlaceSharedLib";
-	
+    
+    public static final String PROPERTY_NOT_REDEPLOY_JSP_FILES = "notRedeployJSPFiles";
+    
 	public static final String PROPERTY_RUN_FROM_WORKSPACE = "runFromWorkspace";
 
 	public static final String PROPERTY_SELECT_CLASSPATH_CONTAINERS = "selectClasspathContainers";
@@ -81,7 +83,7 @@
 
 	public static final String CONSOLE_DEBUG = "-vv";
 
-	public abstract String getContextRoot(IModule module);
+    public abstract String getContextRoot(IModule module) throws Exception ;
 
 	/*
 	 * (non-Javadoc)
@@ -365,7 +367,11 @@
 	public void setInPlaceSharedLib(boolean enable) {
 		setAttribute(PROPERTY_IN_PLACE_SHARED_LIB, enable);
 	}
-	
+
+    public void setNotRedeployJSPFiles(boolean enable){
+        setAttribute(PROPERTY_NOT_REDEPLOY_JSP_FILES,enable);
+    }
+
 	public void setRunFromWorkspace(boolean enable) {
 		setAttribute(PROPERTY_RUN_FROM_WORKSPACE, enable);
 	}

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/IGeronimoServer.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/IGeronimoServer.java?rev=797733&r1=797732&r2=797733&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/IGeronimoServer.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/IGeronimoServer.java Sat Jul 25 09:42:49 2009
@@ -47,6 +47,8 @@
 
 	public IGeronimoVersionHandler getVersionHandler();
 	
+	public boolean isNotRedeployJSPFiles();	
+	
 	public boolean isInPlaceSharedLib();
 	
 	public boolean isRunFromWorkspace();

Added: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/commands/SetNotRedeployJSPFilesCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/commands/SetNotRedeployJSPFilesCommand.java?rev=797733&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/commands/SetNotRedeployJSPFilesCommand.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/commands/SetNotRedeployJSPFilesCommand.java Sat Jul 25 09:42:49 2009
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.ui.commands;
+
+import org.apache.geronimo.st.core.GeronimoServerDelegate;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SetNotRedeployJSPFilesCommand extends ServerCommand {
+
+    boolean value;
+
+    boolean oldValue;
+
+    /**
+     * @param server
+     * @param name
+     */
+    public SetNotRedeployJSPFilesCommand(IServerWorkingCopy server, boolean value) {
+        super(server, "SetRunFromWorkspaceCommand");
+        this.value = value;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.st.ui.commands.ServerCommand#execute()
+     */
+    public void execute() {
+        GeronimoServerDelegate gs = (GeronimoServerDelegate) server.getAdapter(GeronimoServerDelegate.class);
+        oldValue = gs.isNotRedeployJSPFiles();
+        gs.setNotRedeployJSPFiles(value);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.st.ui.commands.ServerCommand#undo()
+     */
+    public void undo() {
+        GeronimoServerDelegate gs = (GeronimoServerDelegate) server.getAdapter(GeronimoServerDelegate.class);
+        gs.setNotRedeployJSPFiles(oldValue);
+    }
+
+}

Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/commands/SetNotRedeployJSPFilesCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java?rev=797733&r1=797732&r2=797733&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java Sat Jul 25 09:42:49 2009
@@ -45,11 +45,14 @@
 
     public static String editorSectionTestEnvTitle;
     public static String editorSectionTestEnvDescription;
+    public static String editorSectionNotRedeployJSPFiles;
     public static String editorSectionRunFromWorkspace;
     public static String editorSectionSharedLibrariesInPlace;
     public static String editorSectionSelectClasspathContainers;
     public static String editorSectionPublishAdvancedTitle;
     public static String editorSectionPublishAdvancedDescription;
+    public static String notRedeployJSPFilesReminder;
+    public static String notRedeployJSPFilesInformation;
 
     public static String publishingTimeout;
     public static String info;

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties?rev=797733&r1=797732&r2=797733&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties Sat Jul 25 09:42:49 2009
@@ -374,10 +374,13 @@
 editorSectionTestEnvTitle=Test Environment
 editorSectionTestEnvDescription=Configure local test environment options.
 editorSectionSharedLibrariesInPlace=Enable in-place shared library support.
+editorSectionNotRedeployJSPFiles=No re-deployment when only JSP files are updated
 editorSectionRunFromWorkspace=Run modules directly from workspace.
 editorSectionSelectClasspathContainers=Select the workspace classpath containers to be provided to the server.
 editorSectionPublishAdvancedTitle=Publish Advanced
 editorSectionPublishAdvancedDescription=Additional options for publishing.
+notRedeployJSPFilesReminder = Important 
+notRedeployJSPFilesInformation = You must enable \"Development Mode\" of your server's JSP compiler for this to function properly. 
 
 publishingTimeout=Publishing Timeout (ms):
 artifactType=Artifact Type:

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/ServerEditorTestEnvSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/ServerEditorTestEnvSection.java?rev=797733&r1=797732&r2=797733&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/ServerEditorTestEnvSection.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/ServerEditorTestEnvSection.java Sat Jul 25 09:42:49 2009
@@ -19,15 +19,18 @@
 import java.util.List;
 
 import org.apache.geronimo.st.core.ClasspathContainersHelper;
+import org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate;
+import org.apache.geronimo.st.ui.commands.SetClasspathContainersCommand;
 import org.apache.geronimo.st.ui.commands.SetInPlaceSharedLibCommand;
+import org.apache.geronimo.st.ui.commands.SetNotRedeployJSPFilesCommand;
 import org.apache.geronimo.st.ui.commands.SetRunFromWorkspaceCommand;
-import org.apache.geronimo.st.ui.commands.SetClasspathContainersCommand;
 import org.apache.geronimo.st.ui.commands.SetSelectClasspathContainersCommand;
 import org.apache.geronimo.st.ui.internal.Messages;
 import org.apache.geronimo.st.ui.internal.Trace;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
 import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
 import org.eclipse.jface.viewers.ICheckStateListener;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.swt.SWT;
@@ -37,9 +40,12 @@
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.forms.widgets.ExpandableComposite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
 import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.util.SocketUtil;
 
 /**
  * @version $Rev$ $Date$
@@ -48,6 +54,7 @@
 
     // SWT widget(s)
     private Button runFromWorkspace;
+    private Button noRedeployJSPFiles;
     private Button inPlaceSharedLib;
     private Button selectClasspathContainers = null;
     private Composite composite = null;
@@ -105,6 +112,30 @@
             }
 
         });
+        
+        //
+        // Don't redeploy JSP files Button
+        //
+        noRedeployJSPFiles = toolkit.createButton(composite, Messages.editorSectionNotRedeployJSPFiles, SWT.CHECK);
+        noRedeployJSPFiles.setSelection(gs.isNotRedeployJSPFiles());
+        
+        noRedeployJSPFiles.setEnabled(!(server.getServerType().supportsRemoteHosts()
+                && !SocketUtil.isLocalhost(server.getHost()))&&gs.getServer().getServerState()==IServer.STATE_STOPPED); 
+        noRedeployJSPFiles.addSelectionListener(new SelectionListener() {
+
+            public void widgetSelected(SelectionEvent e) {
+                execute(new SetNotRedeployJSPFilesCommand(server, noRedeployJSPFiles.getSelection()));
+                
+                if (noRedeployJSPFiles.getSelection()) {
+                    MessageDialog.openInformation(Display.getCurrent().getActiveShell(), 
+                        Messages.notRedeployJSPFilesReminder, Messages.notRedeployJSPFilesInformation);
+                }
+            }
+
+            public void widgetDefaultSelected(SelectionEvent e) {
+            }
+
+        });
 
         //
         // runFromWorkspace Button
@@ -189,7 +220,7 @@
     //
     // CheckboxTableViewer: checkbox
     //
-	public void createCheckbox() {
+    public void createCheckbox() {
         Trace.tracePoint("ENTRY", "ServerEditorTestEnvSection.createCheckbox");
     
         if ( checkbox == null ) {
@@ -216,5 +247,5 @@
         }
 
         Trace.tracePoint("EXIT", "ServerEditorTestEnvSection.createCheckbox");
-	}
+    }
 }

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServer.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServer.java?rev=797733&r1=797732&r2=797733&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServer.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServer.java Sat Jul 25 09:42:49 2009
@@ -1,200 +1,203 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.geronimo.st.v21.core;
-
-import java.io.File;
-import javax.enterprise.deploy.spi.DeploymentManager;
-import javax.enterprise.deploy.spi.factories.DeploymentFactory;
-
-import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
-import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
-import org.apache.geronimo.st.core.GeronimoRuntimeDelegate;
-import org.apache.geronimo.st.core.GeronimoServerDelegate;
-import org.apache.geronimo.st.core.IGeronimoVersionHandler;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jdt.launching.LibraryLocation;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.util.SocketUtil;
-
-/**
- * @version $Rev: 554980 $ $Date: 2007-07-10 11:35:58 -0400 (Tue, 10 Jul 2007) $
- */
-public class GeronimoServer extends GeronimoServerDelegate {
-
-    public static final String PROPERTY_IN_PLACE_SHARED_LIB = "inPlaceSharedLib";
-    public static final String PROPERTY_RUN_FROM_WORKSPACE = "runFromWorkspace";
-
-    private static IGeronimoVersionHandler versionHandler = null;
-
-    private static DeploymentFactory deploymentFactory;
-
-    static {
-        deploymentFactory = new DeploymentFactoryImpl();
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.geronimo.st.core.GenericGeronimoServer#getContextRoot(org.eclipse.wst.server.core.IModule)
-     */
-    public String getContextRoot(IModule module) {
-        return GeronimoV21Utils.getContextRoot(module);
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.geronimo.st.core.IGeronimoServer#getDeployerURL()
-     */
-    public String getDeployerURL() {
-        return "deployer:geronimo:jmx://" + getServer().getHost() + ":" + getRMINamingPort();
-    }
-
-    @Override
-    public String getVMArgs() {
-        String superVMArgs = super.getVMArgs();
-        if (superVMArgs != null && superVMArgs.trim().length() > 0) {
-            return superVMArgs;
-        }
-
-        String runtimeLocation = getServer().getRuntime().getLocation().toString();
-        GeronimoRuntimeDelegate geronimoRuntimeDelegate = (GeronimoRuntimeDelegate) getServer().getRuntime().getAdapter(GeronimoRuntimeDelegate.class);
-        if (geronimoRuntimeDelegate == null) {
-            geronimoRuntimeDelegate = (GeronimoRuntimeDelegate) getServer().getRuntime().loadAdapter(GeronimoRuntimeDelegate.class,new NullProgressMonitor());
-        }
-        IVMInstall vmInstall = geronimoRuntimeDelegate.getVMInstall();
-
-        LibraryLocation[] libLocations = JavaRuntime.getLibraryLocations(vmInstall);
-        IPath vmLibDir = null;
-        for(int i = 0; i < libLocations.length; i++) {
-            LibraryLocation loc = libLocations[i];
-            IPath libDir = loc.getSystemLibraryPath().removeLastSegments(2);
-            if(libDir.toOSString().endsWith("lib")) {
-                vmLibDir = libDir;
-                break;
-            }
-        }
-
-        String cp = System.getProperty("path.separator");
-
-        //-javaagent:"GERONIMO_BASE/bin/jpa.jar"
-        String javaagent = "";
-        File jpaJar = new File(runtimeLocation + "/bin/jpa.jar");
-        if (jpaJar.exists()) {
-            javaagent = "-javaagent:\"" + runtimeLocation + "/bin/jpa.jar\"";
-        }
-
-        //-Djava.ext.dirs="GERONIMO_BASE/lib/ext;JRE_HOME/lib/ext"
-        String javaExtDirs = "-Djava.ext.dirs=\"" + runtimeLocation + "/lib/ext" + cp + vmLibDir.append("ext").toOSString() + "\"";
-
-        //-Djava.endorsed.dirs="GERONIMO_BASE/lib/endorsed;JRE_HOME/lib/endorsed"
-        String javaEndorsedDirs = "-Djava.endorsed.dirs=\"" + runtimeLocation + "/lib/endorsed" + cp + vmLibDir.append("endorsed").toOSString() + "\"";
-
-        // Specify the minimum memory options for the Geronimo server
-        String memoryOpts = "-Xms256m -Xmx512m -XX:MaxPermSize=128m";
-
-        return javaagent + " " + javaExtDirs + " " + javaEndorsedDirs + " " + memoryOpts;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.geronimo.st.core.IGeronimoServer#getJMXServiceURL()
-     */
-    public String getJMXServiceURL() {
-        String host = getServer().getHost();
-        return "service:jmx:rmi://" + host + "/jndi/rmi://" + host + ":" + getRMINamingPort() + "/JMXConnector";
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.geronimo.st.core.IGeronimoServer#getJSR88DeployerJar()
-     */
-    public IPath getJSR88DeployerJar() {
-        return getServer().getRuntime().getLocation().append("/lib/jsr88-deploymentfactory.jar");
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.geronimo.st.core.IGeronimoServer#getDeploymentFactory()
-     */
-    public DeploymentFactory getDeploymentFactory() {
-        return deploymentFactory;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.geronimo.st.core.IGeronimoServer#configureDeploymentManager(javax.enterprise.deploy.spi.DeploymentManager)
-     */
-    public void configureDeploymentManager(DeploymentManager dm) {
-        ((JMXDeploymentManager) dm).setLogConfiguration(true, true);
-        boolean enableInPlace = SocketUtil.isLocalhost(getServer().getHost()) && isRunFromWorkspace();
-        setInPlaceDeployment(dm, enableInPlace);
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.geronimo.st.core.IGeronimoServer#getVersionHandler()
-     */
-    public IGeronimoVersionHandler getVersionHandler() {
-        if (versionHandler == null)
-            versionHandler = new GeronimoV21VersionHandler();
-        return versionHandler;
-    }
-
-    public void setInPlaceDeployment(DeploymentManager dm, boolean enable) {
-        ((JMXDeploymentManager) dm).setInPlace(enable);
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.geronimo.st.core.IGeronimoServer#isInPlace()
-     */
-    public boolean isInPlaceSharedLib() {
-        return getAttribute(PROPERTY_IN_PLACE_SHARED_LIB, false);
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.geronimo.st.core.IGeronimoServer#isRunFromWorkspace()
-     */
-    public boolean isRunFromWorkspace() {
-        return getAttribute(PROPERTY_RUN_FROM_WORKSPACE, false);
-    }
-
-    public void setInPlaceSharedLib(boolean enable) {
-        setAttribute(PROPERTY_IN_PLACE_SHARED_LIB, enable);
-    }
-
-    public void setRunFromWorkspace(boolean enable) {
-        setAttribute(PROPERTY_RUN_FROM_WORKSPACE, enable);
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.geronimo.st.core.GeronimoServerDelegate#setDefaults(org.eclipse.core.runtime.IProgressMonitor)
-     */
-    public void setDefaults(IProgressMonitor monitor) {
-        super.setDefaults(monitor);
-        setInPlaceSharedLib(false);
-        setRunFromWorkspace(false);
-    }
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core;
+
+import java.io.File;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.factories.DeploymentFactory;
+
+import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
+import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
+import org.apache.geronimo.st.core.GeronimoRuntimeDelegate;
+import org.apache.geronimo.st.core.GeronimoServerDelegate;
+import org.apache.geronimo.st.core.IGeronimoVersionHandler;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.LibraryLocation;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.util.SocketUtil;
+
+/**
+ * @version $Rev: 554980 $ $Date: 2007-07-10 11:35:58 -0400 (Tue, 10 Jul 2007) $
+ */
+public class GeronimoServer extends GeronimoServerDelegate {
+
+    public static final String PROPERTY_IN_PLACE_SHARED_LIB = "inPlaceSharedLib";
+    public static final String PROPERTY_RUN_FROM_WORKSPACE = "runFromWorkspace";
+
+    private static IGeronimoVersionHandler versionHandler = null;
+
+    private static DeploymentFactory deploymentFactory;
+
+    static {
+        deploymentFactory = new DeploymentFactoryImpl();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.st.core.GenericGeronimoServer#getContextRoot(org.eclipse.wst.server.core.IModule)
+     */
+    public String getContextRoot(IModule module) {
+        return GeronimoV21Utils.getContextRoot(module);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.core.IGeronimoServer#getDeployerURL()
+     */
+    public String getDeployerURL() {
+        return "deployer:geronimo:jmx://" + getServer().getHost() + ":" + getRMINamingPort();
+    }
+
+    @Override
+    public String getVMArgs() {
+        String superVMArgs = super.getVMArgs();
+        if (superVMArgs != null && superVMArgs.trim().length() > 0) {
+            return superVMArgs;
+        }
+
+        String runtimeLocation = getServer().getRuntime().getLocation().toString();
+        GeronimoRuntimeDelegate geronimoRuntimeDelegate = (GeronimoRuntimeDelegate) getServer().getRuntime().getAdapter(GeronimoRuntimeDelegate.class);
+        if (geronimoRuntimeDelegate == null) {
+            geronimoRuntimeDelegate = (GeronimoRuntimeDelegate) getServer().getRuntime().loadAdapter(GeronimoRuntimeDelegate.class,new NullProgressMonitor());
+        }
+        IVMInstall vmInstall = geronimoRuntimeDelegate.getVMInstall();
+
+        LibraryLocation[] libLocations = JavaRuntime.getLibraryLocations(vmInstall);
+        IPath vmLibDir = null;
+        for(int i = 0; i < libLocations.length; i++) {
+            LibraryLocation loc = libLocations[i];
+            IPath libDir = loc.getSystemLibraryPath().removeLastSegments(2);
+            if(libDir.toOSString().endsWith("lib")) {
+                vmLibDir = libDir;
+                break;
+            }
+        }
+
+        String cp = System.getProperty("path.separator");
+
+        //-javaagent:"GERONIMO_BASE/bin/jpa.jar"
+        String javaagent = "";
+        File jpaJar = new File(runtimeLocation + "/bin/jpa.jar");
+        if (jpaJar.exists()) {
+            javaagent = "-javaagent:\"" + runtimeLocation + "/bin/jpa.jar\"";
+        }
+
+        //-Djava.ext.dirs="GERONIMO_BASE/lib/ext;JRE_HOME/lib/ext"
+        String javaExtDirs = "-Djava.ext.dirs=\"" + runtimeLocation + "/lib/ext" + cp + vmLibDir.append("ext").toOSString() + "\"";
+
+        //-Djava.endorsed.dirs="GERONIMO_BASE/lib/endorsed;JRE_HOME/lib/endorsed"
+        String javaEndorsedDirs = "-Djava.endorsed.dirs=\"" + runtimeLocation + "/lib/endorsed" + cp + vmLibDir.append("endorsed").toOSString() + "\"";
+
+        // Specify the minimum memory options for the Geronimo server
+        String memoryOpts = "-Xms256m -Xmx512m -XX:MaxPermSize=128m";
+
+        return javaagent + " " + javaExtDirs + " " + javaEndorsedDirs + " " + memoryOpts;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.core.IGeronimoServer#getJMXServiceURL()
+     */
+    public String getJMXServiceURL() {
+        String host = getServer().getHost();
+        return "service:jmx:rmi://" + host + "/jndi/rmi://" + host + ":" + getRMINamingPort() + "/JMXConnector";
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.core.IGeronimoServer#getJSR88DeployerJar()
+     */
+    public IPath getJSR88DeployerJar() {
+        return getServer().getRuntime().getLocation().append("/lib/jsr88-deploymentfactory.jar");
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.core.IGeronimoServer#getDeploymentFactory()
+     */
+    public DeploymentFactory getDeploymentFactory() {
+        return deploymentFactory;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.core.IGeronimoServer#configureDeploymentManager(javax.enterprise.deploy.spi.DeploymentManager)
+     */
+    public void configureDeploymentManager(DeploymentManager dm) {
+        ((JMXDeploymentManager) dm).setLogConfiguration(true, true);
+        boolean enableInPlace = SocketUtil.isLocalhost(getServer().getHost()) && isRunFromWorkspace();
+        setInPlaceDeployment(dm, enableInPlace);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.geronimo.st.core.IGeronimoServer#getVersionHandler()
+     */
+    public IGeronimoVersionHandler getVersionHandler() {
+        if (versionHandler == null)
+            versionHandler = new GeronimoV21VersionHandler();
+        return versionHandler;
+    }
+
+    public void setInPlaceDeployment(DeploymentManager dm, boolean enable) {
+        ((JMXDeploymentManager) dm).setInPlace(enable);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.st.core.IGeronimoServer#isInPlace()
+     */
+    public boolean isInPlaceSharedLib() {
+        return getAttribute(PROPERTY_IN_PLACE_SHARED_LIB, false);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.st.core.IGeronimoServer#isRunFromWorkspace()
+     */
+    public boolean isRunFromWorkspace() {
+        return getAttribute(PROPERTY_RUN_FROM_WORKSPACE, false);
+    }
+
+    public void setInPlaceSharedLib(boolean enable) {
+        setAttribute(PROPERTY_IN_PLACE_SHARED_LIB, enable);
+    }
+
+    public void setRunFromWorkspace(boolean enable) {
+        setAttribute(PROPERTY_RUN_FROM_WORKSPACE, enable);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.st.core.GeronimoServerDelegate#setDefaults(org.eclipse.core.runtime.IProgressMonitor)
+     */
+    public void setDefaults(IProgressMonitor monitor) {
+        super.setDefaults(monitor);
+        setInPlaceSharedLib(false);
+        setRunFromWorkspace(false);
+    }
+
+    public boolean isNotRedeployJSPFiles() {
+        return getAttribute(PROPERTY_NOT_REDEPLOY_JSP_FILES,false);
+    }
 }
\ No newline at end of file