View | Details | Raw Unified | Return to bug 359385 | Differences between
and this patch

Collapse All | Expand All

(-)a/plugins/org.eclipse.jst.j2ee/classpathdep/org/eclipse/jst/j2ee/classpathdep/ClasspathDependencyUtil.java (-2 / +24 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007 BEA Systems, Inc. and others.
2
 * Copyright (c) 2007-2013 BEA Systems, Inc. and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 7-12 Link Here
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 * BEA Systems, Inc. - initial API and implementation
9
 * BEA Systems, Inc. - initial API and implementation
10
 * Fred Bricon (Red Hat, Inc.) - 359385 : override classpath entry's archive name 
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.jst.j2ee.classpathdep;
12
package org.eclipse.jst.j2ee.classpathdep;
12
13
Lines 17-22 Link Here
17
import java.util.LinkedHashMap;
18
import java.util.LinkedHashMap;
18
import java.util.List;
19
import java.util.List;
19
import java.util.Map;
20
import java.util.Map;
21
20
import org.eclipse.core.resources.IContainer;
22
import org.eclipse.core.resources.IContainer;
21
import org.eclipse.core.resources.IFile;
23
import org.eclipse.core.resources.IFile;
22
import org.eclipse.core.resources.IProject;
24
import org.eclipse.core.resources.IProject;
Lines 631-637 public static IPath calculateDefaultRuntimePath(IVirtualComponent parentComponen Link Here
631
	}
633
	}
632
	
634
	
633
	/**
635
	/**
634
	 * Retrieves the archive name for the specified classpath entry
636
	 * Retrieves the archive name for the specified classpath entry. 
637
	 * For library entries, if a classpath attribute with {@link IClasspathDependencyConstants.CLASSPATH_ARCHIVENAME_ATTRIBUTE} was set, 
638
	 * its value will be returned.
639
	 *   
635
	 * @param entry The entry.
640
	 * @param entry The entry.
636
	 * @return The archive name.
641
	 * @return The archive name.
637
	 */
642
	 */
Lines 647-656 public static String getArchiveName(final IClasspathEntry entry) { Link Here
647
			}
652
			}
648
			return resource.getFullPath().toString();
653
			return resource.getFullPath().toString();
649
		}
654
		}
655
		
656
		//bug 359385 : Override default archive name
657
		String customArchiveName = getCustomArchiveName(entry);
658
		if (customArchiveName != null) {
659
			return customArchiveName;
660
		}
650
		final IPath entryLocation = getEntryLocation(entry);
661
		final IPath entryLocation = getEntryLocation(entry);
651
		return entryLocation.lastSegment();
662
		return entryLocation.lastSegment();
652
	}
663
	}
653
	
664
	
665
	private static String getCustomArchiveName(IClasspathEntry entry) {
666
		IClasspathAttribute[] extraAttributes = entry.getExtraAttributes();
667
		if (extraAttributes != null) {
668
			for (IClasspathAttribute cpa : extraAttributes) {
669
				if (cpa != null && CLASSPATH_ARCHIVENAME_ATTRIBUTE.equals(cpa.getName())) { 
670
					return cpa.getValue();
671
				}
672
			}
673
		}
674
		return null;
675
	}
654
676
655
	
677
	
656
	/**
678
	/**
(-)a/plugins/org.eclipse.jst.j2ee/classpathdep/org/eclipse/jst/j2ee/classpathdep/IClasspathDependencyConstants.java (-2 / +9 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007 BEA Systems, Inc. and others.
2
 * Copyright (c) 2007-2013 BEA Systems, Inc. and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 7-12 Link Here
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 * BEA Systems, Inc. - initial API and implementation
9
 * BEA Systems, Inc. - initial API and implementation
10
 * Fred Bricon (Red Hat, Inc.) - 359385 : added CLASSPATH_ARCHIVENAME_ATTRIBUTE 
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.jst.j2ee.classpathdep;
12
package org.eclipse.jst.j2ee.classpathdep;
12
13
Lines 81-84 Link Here
81
	 */
82
	 */
82
	public static final IPath WEB_INF_LIB_PATH = new Path(J2EEConstants.WEB_INF_LIB).makeAbsolute();
83
	public static final IPath WEB_INF_LIB_PATH = new Path(J2EEConstants.WEB_INF_LIB).makeAbsolute();
83
	
84
	
85
	
86
	/**
87
	 * Name of the custom Java classpath entry attribute that is used to override the exported/deployed 
88
	 * archive name of a given binary.
89
	 */
90
	public static final String CLASSPATH_ARCHIVENAME_ATTRIBUTE = "org.eclipse.jst.component.archivename"; //$NON-NLS-1$
91
	
84
	}
92
	}
85
- 

Return to bug 359385