Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 155439
Collapse All | Expand All

(-)src/org/eclipse/jst/ws/internal/axis/consumption/ui/task/CopyAxisJarCommand.java (+89 lines)
Lines 12-17 Link Here
12
 * 20060509   125094 sengpl@ca.ibm.com - Seng Phung-Lu, Use WorkspaceModifyOperation
12
 * 20060509   125094 sengpl@ca.ibm.com - Seng Phung-Lu, Use WorkspaceModifyOperation
13
 * 20060515   115225 sengpl@ca.ibm.com - Seng Phung-Lu
13
 * 20060515   115225 sengpl@ca.ibm.com - Seng Phung-Lu
14
 * 20060517   142342 kathy@ca.ibm.com - Kathy Chan
14
 * 20060517   142342 kathy@ca.ibm.com - Kathy Chan
15
 * 20060828	  155439 mahutch@ca.ibm.com - Mark Hutchinson
15
 *******************************************************************************/
16
 *******************************************************************************/
16
package org.eclipse.jst.ws.internal.axis.consumption.ui.task;
17
package org.eclipse.jst.ws.internal.axis.consumption.ui.task;
17
18
Lines 60-65 Link Here
60
	  "saaj.jar",
61
	  "saaj.jar",
61
	  "wsdl4j-1.5.1.jar"
62
	  "wsdl4j-1.5.1.jar"
62
  };
63
  };
64
  //these are the jar sizes that correspond to the jars in JARLIST.
65
  private static long[] JARSIZES = {
66
	  1632995L,
67
	  71442L,
68
	  32062L,
69
	  19419L,
70
	  126771L
71
  };
72
  private static long COMMON_LOGGING_JAR_SIZE = 38015L;
73
  //Web Services Jars Used in previous Versions of WTP but now obsolete
74
  private static String[] OBSOLETE_JARS = new String[]{
75
	  "commons-discovery.jar",
76
	  "commons-logging.jar",
77
	  "log4j-1.2.4.jar",
78
	  "log4j-1.2.8.jar",
79
	  "wsdl4j.jar",
80
	  "axis-ant.jar"
81
  };
82
  
83
  
63
  public static String COMMON_LOGGING_PLUGIN_ID = "org.apache.commons_logging"; //$NON-NLS-1$
84
  public static String COMMON_LOGGING_PLUGIN_ID = "org.apache.commons_logging"; //$NON-NLS-1$
64
  public static String COMMON_LOGGING_JAR = "commons-logging-1.0.4.jar"; //$NON-NLS-1$
85
  public static String COMMON_LOGGING_JAR = "commons-logging-1.0.4.jar"; //$NON-NLS-1$
65
  public static String PATH_TO_JARS_IN_PLUGIN = "lib/";
86
  public static String PATH_TO_JARS_IN_PLUGIN = "lib/";
Lines 121-126 Link Here
121
      return;
142
      return;
122
    }
143
    }
123
	
144
	
145
    deleteObsoleteJars(webModulePath);
146
    
124
	for (int i=0; i<JARLIST.length; ) {
147
	for (int i=0; i<JARLIST.length; ) {
125
		copyIFile(AXIS_RUNTIME_PLUGIN_ID, "lib/"+JARLIST[i], webModulePath, "WEB-INF/lib/"+JARLIST[i++], status, env, monitor); 
148
		copyIFile(AXIS_RUNTIME_PLUGIN_ID, "lib/"+JARLIST[i], webModulePath, "WEB-INF/lib/"+JARLIST[i++], status, env, monitor); 
126
	    if (status.getSeverity() == Status.ERROR)
149
	    if (status.getSeverity() == Status.ERROR)
Lines 163-168 Link Here
163
    }
186
    }
164
  }
187
  }
165
188
189
  /*
190
   * Check for any obsolete Jars in WEB-INF/lib folder
191
   * Obsolete jars would be found in projects migrated
192
   * from older versions of WTP
193
   */
194
  private void deleteObsoleteJars(IPath webModulePath)
195
  {  
196
	  //First check for Any jars that have names that are known to be obsolete
197
	  for (int i=0; i <OBSOLETE_JARS.length; i++)
198
	  {
199
		  IPath path = webModulePath.append("WEB-INF/lib/" + OBSOLETE_JARS[i]);
200
		  
201
		  IFile resource = ResourceUtils.getWorkspaceRoot().getFile(path);
202
		  if (resource.exists())
203
		  {
204
			  deleteResource(resource);
205
		  }
206
	  }
207
	  /*
208
	   * Next check for jars with the same name as a Jar in JARLIST
209
	   * but that have a different size than in JARSIZES.  We need to 
210
	   * do this because a jar could have the same name but still be out
211
	   * of date so size is only way to check.
212
	   * E.g. all versions of axis have the same name of axis.jar
213
	   */
214
	  for (int i=0; i< JARLIST.length; i++)
215
	  {
216
		  IPath path = webModulePath.append("WEB-INF/lib/" + JARLIST[i]);
217
		  IFile resource = ResourceUtils.getWorkspaceRoot().getFile(path);
218
		  if (resource.exists())
219
		  {
220
			  //calculate the size of the resource by getting the java.io.File    	  
221
			  long fileSize =resource.getLocation().toFile().length();
222
			  if (fileSize != JARSIZES[i])
223
			  {
224
				  deleteResource(resource);
225
			  }
226
		  }
227
	  }
228
	  //Finally check logging plugin (only left seperate because not in JARLIST)
229
	  IPath path = webModulePath.append("WEB-INF/lib/" + COMMON_LOGGING_JAR);
230
	  IFile resource = ResourceUtils.getWorkspaceRoot().getFile(path);
231
	  if (resource.exists())
232
	  {
233
		  //calculate the size of the resource by getting the java.io.File    	  
234
		  long fileSize =resource.getLocation().toFile().length();
235
		  if (fileSize != COMMON_LOGGING_JAR_SIZE)
236
		  {
237
			  deleteResource(resource);
238
		  }
239
	  }
240
  }
241
  
242
  private void deleteResource(IFile resource)
243
  {	  //delete the resource
244
	  try
245
	  {
246
		  //System.out.println("Obsolete Jar!! " + resource.getName());
247
		  resource.delete(true, null);
248
	  }
249
	  catch (Exception e)
250
	  {  //e.printStackTrace();
251
	  }
252
  }
253
 
254
166
  public IStatus addAxisJarsToBuildPath(IProject p, IEnvironment env, IProgressMonitor monitor)
255
  public IStatus addAxisJarsToBuildPath(IProject p, IEnvironment env, IProgressMonitor monitor)
167
  {
256
  {
168
	  String[] jarNames = new String[JARLIST.length];
257
	  String[] jarNames = new String[JARLIST.length];

Return to bug 155439