Permalink
Browse files

[340918] deploy-name of EAR projects is ignored during deployment

  • Loading branch information...
1 parent dd67198 commit 5d1f7d5c1cd43711c60b05fecb3d4267a6c48c03 @elsony elsony committed Feb 15, 2013
@@ -1,5 +1,5 @@
/***************************************************************************************************
- * Copyright (c) 2005, 2009 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
+ * Copyright (c) 2005, 2013 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
* accompanying materials are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
@@ -20,6 +20,7 @@
import java.util.Map;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
+
import org.eclipse.ant.ui.launching.IAntLaunchConfigurationConstants;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -52,6 +53,7 @@
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IModuleArtifact;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
import org.osgi.framework.Bundle;
@@ -319,16 +321,16 @@ private IPath getProjectWorkingLocation() {
}
private String guessModuleName(IModule module) {
- String moduleName = module.getName();
+ String deployName = ServerUtil.getModuleDisplayName(module);
if ("jst.web".equals(getModuleTypeId())) { //$NON-NLS-1$
IWebModule webModule = (IWebModule) getModule()[0].loadAdapter(IWebModule.class, null);
if (webModule == null) {
- return module.getName();
+ return deployName;
}
String contextRoot = webModule.getURI(module);
- moduleName = contextRoot.substring(0, contextRoot.lastIndexOf('.'));
+ deployName = contextRoot.substring(0, contextRoot.lastIndexOf('.'));
}
- return moduleName;
+ return deployName;
}
private String guessContextRoot(IModule module) {
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.server.core; singleton:=true
-Bundle-Version: 1.4.100.qualifier
+Bundle-Version: 1.5.0.qualifier
Bundle-Activator: org.eclipse.wst.server.core.internal.ServerPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2003, 2012 IBM Corporation and others.
+ * Copyright (c) 2003, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -137,6 +137,21 @@ public static IModule getModule(String moduleId) {
}
/**
+ * Get the display name of a given module
+ * @return the display name
+ * @since 1.5
+ */
+ public static String getModuleDisplayName(IModule curModule) {
+ if (curModule instanceof IModule2) {
+ String displayProp = ((IModule2)curModule).getProperty(IModule2.PROP_DISPLAY_NAME);
+ if (displayProp != null) {
+ return displayProp;
+ }
+ }
+ return curModule.getName();
+ }
+
+ /**
* Return all the available modules from all factories whose
* type matches the given module types.
* <p>
@@ -796,4 +811,5 @@ public static int getMonitoredPort(IServer server, int port, String contentType)
public static ISchedulingRule getServerSchedulingRule(IServer server) {
return server;
}
+
}
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,16 +10,20 @@
*******************************************************************************/
package org.eclipse.wst.server.core.internal;
+import java.util.Map;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.server.core.*;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IModuleType;
+import org.eclipse.wst.server.core.IModule2;
import org.eclipse.wst.server.core.model.ModuleDelegate;
/**
*
*/
-public class Module implements IModule {
+public class Module implements IModule2 {
protected String id;
protected String name;
protected ModuleFactory factory;
@@ -28,6 +32,8 @@
protected ModuleDelegate delegate;
protected String id2;
+ protected Map<String, String> properties;
+
/**
* Module constructor.
*
@@ -39,6 +45,20 @@
* @param project
*/
public Module(ModuleFactory factory, String id, String name, String type, String version, IProject project) {
+ this(factory, id, name, type, version, project, null);
+ }
+
+ /**
+ * Module constructor with properties
+ *
+ * @param factory
+ * @param id
+ * @param name
+ * @param type
+ * @param version
+ * @param project
+ */
+ public Module(ModuleFactory factory, String id, String name, String type, String version, IProject project, Map<String, String> properties) {
super();
this.factory = factory;
this.project = project;
@@ -50,6 +70,7 @@ public Module(ModuleFactory factory, String id, String name, String type, String
else
id2 = ":";
id2 += id;
+ this.properties = properties;
}
/**
@@ -268,4 +289,12 @@ public boolean exists() {
public String toString() {
return "Module[" + name + "," + id2 + "]";
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.server.core.IModule2#getProperty(java.lang.String)
+ */
+ public String getProperty(String key) {
+ return properties == null || key == null ? null : properties.get(key);
+ }
}
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -123,6 +124,25 @@ protected final IModule createModule(String id, String name, String type, String
}
/**
+ * Creates a module instance with the given static information,
+ * including a map of properties.
+ *
+ * This method is used by module factory delegates to create module instances.
+ *
+ * @param id the module id
+ * @param name the module name
+ * @param type the module type id
+ * @param version the module version id
+ * @param project the project that the module is contained in
+ * @param properties a map of key/value pairs for additional information
+ * @return a module instance
+ * @since 1.4
+ */
+ protected final IModule createModule(String id, String name, String type, String version, IProject project, Map<String, String> properties) {
+ return new Module(factory, id, name, type, version, project, properties);
+ }
+
+ /**
* Creates the module delegate for a module with the given information.
* This method is called when a client needs to access the module delegate
* associated with the given module.
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -251,8 +251,7 @@ public String getText(Object element) {
return decorate(module.getName(), modules);
} else if (element instanceof ModuleServer) {
ModuleServer ms = (ModuleServer) element;
- IModule module = ms.module[ms.module.length - 1];
- return decorate(module.getName(), ms);
+ return decorate(ms.getModuleDisplayName(), ms);
} else if (element instanceof IWorkbenchAdapter) {
return ((IWorkbenchAdapter) element).getLabel(null);
}
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -190,7 +190,7 @@ protected Composite createToolTipContentArea(Event event, Composite parent) {
if (module != null) {
IModule[] modules = module.getModule();
IModule m = modules[modules.length - 1];
- sText.setText("<b>" + m.getName() + "</b>");
+ sText.setText("<b>" + ServerUtil.getModuleDisplayName(m) + "</b>");
//sText.setText("<b>" + m.getName() + "</b></p>" + m.getModuleType().getName());
StyledText sText2 = new StyledText(parent, SWT.NONE);
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008,2010 IBM Corporation and others.
+ * Copyright (c) 2008,2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -44,9 +44,7 @@ public String getText(Object element) {
ModuleServer ms = (ModuleServer) element;
if (ms.module == null)
return "";
- int size = ms.module.length;
- String name = ms.module[size - 1].getName();
- return name;
+ return ms.getModuleDisplayName();
}
if( element instanceof IServer ) {
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.server.ui.IServerModule;
/**
* A utility class for referencing a server and a module at the same time.
@@ -57,7 +58,19 @@ public IServer getServer() {
public IModule[] getModule() {
return module;
}
-
+
+ /**
+ * Get the display name of the module of this module server.
+ * @return the display name
+ */
+ public String getModuleDisplayName() {
+ int size = module.length;
+ if (size == 0) {
+ return null;
+ }
+ return ServerUtil.getModuleDisplayName(module[size - 1]);
+ }
+
/**
* @see Object#equals(Object)
*/
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2012 IBM Corporation and others.
+ * Copyright (c) 2003, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -510,7 +510,7 @@ public int compare(Viewer viewer, Object e1, Object e2) {
if (e1 instanceof ModuleServer && e2 instanceof ModuleServer) {
ModuleServer s1 = (ModuleServer) e1;
ModuleServer s2 = (ModuleServer) e2;
- return (s1.module[s1.module.length - 1].getName().compareToIgnoreCase(s2.module[s2.module.length - 1].getName()));
+ return (s1.getModuleDisplayName().compareToIgnoreCase(s2.getModuleDisplayName()));
}
return super.compare(viewer, e1, e2);

0 comments on commit 5d1f7d5

Please sign in to comment.