| package org.eclipse.wtp.releng.tools; |
| |
| import java.io.File; |
| |
| |
| public class UpdateFeatureUpdateFile { |
| |
| private String featuresDirectoryLocation = "/davidw-home/wtp201/eclipse/features"; |
| |
| private String featureUpdateFileLocation; |
| private FullJarNameParser fullJarNameParser = new FullJarNameParser(); |
| |
| private String[] featuresOfInterest = new String[]{"org.eclipse.wst", "org.eclipse.jst", "org.eclipse.jpt.feature", "org.eclipse.wst.xml_ui.feature", "org.eclipse.wst.common_ui.feature", "org.eclipse.wst.sdk", "org.eclipse.jst.sdk", "org.eclipse.jpt_sdk.feature", "org.eclipse.wst.xml_sdk.feature", "org.eclipse.wst.common_sdk.feature",}; |
| |
| private String[] shortListOfInterest = new String[]{"org.eclipse.wst", "org.eclipse.jst", "org.eclipse.jpt.feature", "org.eclipse.wst.xml_ui.feature", "org.eclipse.wst.common_ui.feature"}; |
| |
| public static void main(String[] args) { |
| |
| new UpdateFeatureUpdateFile().getFeatureDirectories(); |
| } |
| |
| private void getFeatureDirectories() { |
| System.out.println("featuresDirectoryLocation: " + getFeaturesDirectoryLocation()); |
| File featureDirectory = new File(featuresDirectoryLocation); |
| String[] featureDirectories = featureDirectory.list(); |
| if (featureDirectories == null) { |
| System.out.println("ERROR: no featues found at location"); |
| } |
| else { |
| System.out.println("Full List for main WTP site"); |
| System.out.println(); |
| doList(featureDirectories, featuresOfInterest); |
| System.out.println(); |
| System.out.println("Short List for Europa site"); |
| System.out.println(); |
| doList(featureDirectories, shortListOfInterest); |
| } |
| } |
| |
| private void doList(String[] featureDirectories, String[] featureOfFocus) { |
| for (int i = 0; i < featureDirectories.length; i++) { |
| String directoryName = featureDirectories[i]; |
| fullJarNameParser.parse(directoryName); |
| String projectName = fullJarNameParser.getProjectString(); |
| String versionString = fullJarNameParser.getVersionString(); |
| if (contains(projectName, featureOfFocus)) { |
| System.out.println(" <ant antfile=\"updateMirrorProject.xml\">\r\n" + " <property\r\n" + " name=\"featureId\"\r\n" + " value=\"" + projectName + "\" />\r\n" + " <property\r\n" + " name=\"version\"\r\n" + " value=\"" + versionString + "\" />\r\n" + " </ant>"); |
| |
| } |
| |
| |
| } |
| } |
| |
| public String getFeaturesDirectoryLocation() { |
| return featuresDirectoryLocation; |
| } |
| |
| public void setFeaturesDirectoryLocation(String featuresDirectoryLocation) { |
| this.featuresDirectoryLocation = featuresDirectoryLocation; |
| } |
| |
| public String getFeatureUpdateFileLocation() { |
| return featureUpdateFileLocation; |
| } |
| |
| public void setFeatureUpdateFileLocation(String featureUpdateFileLocation) { |
| this.featureUpdateFileLocation = featureUpdateFileLocation; |
| } |
| |
| private boolean contains(String needle, String[] haystack) { |
| boolean result = false; |
| |
| for (int i = 0; i < haystack.length; i++) { |
| if (needle.equals(haystack[i])) { |
| result = true; |
| break; |
| } |
| } |
| return result; |
| } |
| } |