Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 34327 Details for
Bug 34757
Support for other repository
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
34757_pluggable_fetch_script_builder.patch.txt
34757_pluggable_fetch_script_builder.patch.txt (text/plain), 70.70 KB, created by
Gunnar Wagenknecht
on 2006-02-08 03:01:32 EST
(
hide
)
Description:
34757_pluggable_fetch_script_builder.patch.txt
Filename:
MIME Type:
Creator:
Gunnar Wagenknecht
Created:
2006-02-08 03:01:32 EST
Size:
70.70 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.build >Index: src/org/eclipse/pde/internal/build/ant/ITask.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/build/ant/ITask.java >diff -N src/org/eclipse/pde/internal/build/ant/ITask.java >--- src/org/eclipse/pde/internal/build/ant/ITask.java 21 Feb 2005 23:31:25 -0000 1.11 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,25 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2004 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 >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM - Initial API and implementation >- *******************************************************************************/ >-package org.eclipse.pde.internal.build.ant; >- >-/** >- * Interface for tasks. >- */ >-public interface ITask { >- >- /** >- * Print the information for this task to the given script. Use the given >- * tab index for indenting. >- * >- * @param script the script to print to >- */ >- public void print(AntScript script); >-} >Index: src/org/eclipse/pde/internal/build/ant/AntScript.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant/AntScript.java,v >retrieving revision 1.42 >diff -u -r1.42 AntScript.java >--- src/org/eclipse/pde/internal/build/ant/AntScript.java 23 Jan 2006 15:55:23 -0000 1.42 >+++ src/org/eclipse/pde/internal/build/ant/AntScript.java 8 Feb 2006 07:54:49 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * Copyright (c) 2000, 2006 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,13 +12,15 @@ > > import java.io.*; > import java.util.*; >+import org.eclipse.pde.build.ant.IAntScript; >+import org.eclipse.pde.build.ant.AntTask; > > /** > * Class for producing Ant scripts. Contains convenience methods for creating the > * XML elements required for Ant scripts. See the <a href="http://jakarta.apache.org/ant">Ant</a> > * website for more details on Ant scripts and the particular Ant tasks. > */ >-public class AntScript { >+public class AntScript implements IAntScript { > > protected OutputStream out; > protected PrintWriter output; >@@ -697,10 +699,10 @@ > /** > * Print the given task to the Ant script. > * >- * @param task the task to print >+ * @param antTask the task to print > */ >- public void print(ITask task) { >- task.print(this); >+ public void print(AntTask antTask) { >+ antTask.print(this); > } > > /** >Index: src/org/eclipse/pde/internal/build/ant/JavacTask.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant/JavacTask.java,v >retrieving revision 1.24 >diff -u -r1.24 JavacTask.java >--- src/org/eclipse/pde/internal/build/ant/JavacTask.java 7 Dec 2005 22:34:39 -0000 1.24 >+++ src/org/eclipse/pde/internal/build/ant/JavacTask.java 8 Feb 2006 07:54:49 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2004 IBM Corporation and others. >+ * Copyright (c) 2000, 2006 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,12 +10,14 @@ > *******************************************************************************/ > package org.eclipse.pde.internal.build.ant; > >+import org.eclipse.pde.build.ant.IAntScript; >+import org.eclipse.pde.build.ant.AntTask; > import org.eclipse.pde.internal.build.IXMLConstants; > > /** > * Wrapper class for the Ant javac task. > */ >-public class JavacTask implements ITask { >+public class JavacTask extends AntTask { > > protected String classpathId; > protected String bootclasspath; >@@ -40,9 +42,17 @@ > } > > /** >- * @see ITask#print(AntScript) >+ * @param script >+ * @see AntTask#print(IAntScript) > */ >- public void print(AntScript script) { >+ public void print(IAntScript script) { >+ internalPrint((AntScript) script); >+ } >+ >+ /** >+ * @see AntTask#print(AntScript) >+ */ >+ public void internalPrint(AntScript script) { > script.printTab(); > script.print("<javac"); //$NON-NLS-1$ > script.printAttribute("destdir", destdir, false); //$NON-NLS-1$ >Index: src/org/eclipse/pde/internal/build/ant/ConditionTask.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant/ConditionTask.java,v >retrieving revision 1.17 >diff -u -r1.17 ConditionTask.java >--- src/org/eclipse/pde/internal/build/ant/ConditionTask.java 21 Feb 2005 23:31:25 -0000 1.17 >+++ src/org/eclipse/pde/internal/build/ant/ConditionTask.java 8 Feb 2006 07:54:49 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2004 IBM Corporation and others. >+ * Copyright (c) 2000, 2006 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,10 +10,13 @@ > *******************************************************************************/ > package org.eclipse.pde.internal.build.ant; > >+import org.eclipse.pde.build.ant.IAntScript; >+import org.eclipse.pde.build.ant.AntTask; >+ > /** > * Represents an Ant condition. > */ >-public class ConditionTask implements ITask { >+public class ConditionTask extends AntTask { > > protected String property; > protected String value; >@@ -33,9 +36,9 @@ > } > > /** >- * @see ITask#print(AntScript) >+ * @see AntTask#print(IAntScript) > */ >- public void print(AntScript script) { >+ private void internalPrint(AntScript script) { > script.printTab(); > script.print("<condition"); //$NON-NLS-1$ > script.printAttribute("property", property, true); //$NON-NLS-1$ >@@ -44,4 +47,12 @@ > condition.print(script); > script.println("</condition>"); //$NON-NLS-1$ > } >+ >+ /** >+ * @param script >+ * @see AntTask#print(IAntScript) >+ */ >+ public void print(IAntScript script) { >+ internalPrint((AntScript) script); >+ } > } >Index: src_ant/org/eclipse/pde/internal/build/tasks/FetchFileGeneratorTask.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src_ant/org/eclipse/pde/internal/build/tasks/FetchFileGeneratorTask.java,v >retrieving revision 1.12 >diff -u -r1.12 FetchFileGeneratorTask.java >--- src_ant/org/eclipse/pde/internal/build/tasks/FetchFileGeneratorTask.java 21 Feb 2005 23:31:25 -0000 1.12 >+++ src_ant/org/eclipse/pde/internal/build/tasks/FetchFileGeneratorTask.java 8 Feb 2006 07:54:49 -0000 >@@ -17,7 +17,7 @@ > import org.eclipse.pde.internal.build.packager.FetchFileGenerator; > > /** >- * Internal Task. >+ * Internal AntTask. > * Generate fetch script to get files from a URL based on a packager map. > * @since 3.0 > */ >Index: src_ant/org/eclipse/pde/internal/build/tasks/UnzipperGeneratorTask.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src_ant/org/eclipse/pde/internal/build/tasks/UnzipperGeneratorTask.java,v >retrieving revision 1.13 >diff -u -r1.13 UnzipperGeneratorTask.java >--- src_ant/org/eclipse/pde/internal/build/tasks/UnzipperGeneratorTask.java 21 Feb 2005 23:31:25 -0000 1.13 >+++ src_ant/org/eclipse/pde/internal/build/tasks/UnzipperGeneratorTask.java 8 Feb 2006 07:54:49 -0000 >@@ -17,7 +17,7 @@ > import org.eclipse.pde.internal.build.packager.UnzipperGenerator; > > /** >- * Internal Task. >+ * Internal AntTask. > * This task generates an unzipper script that unzip a files. > * @since 3.0 > */ >Index: .cvsignore >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/.cvsignore,v >retrieving revision 1.4 >diff -u -r1.4 .cvsignore >--- .cvsignore 3 Feb 2006 15:58:54 -0000 1.4 >+++ .cvsignore 8 Feb 2006 07:54:48 -0000 >@@ -1,3 +1,9 @@ > bin > lib > bin_ant >+temp* >+build.xml >+pdebuild.jar >+org.eclipse.pde.build_*.zip >+pdebuildsrc.zip >+javaCompiler.pdebuild.jar.args >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/plugin.xml,v >retrieving revision 1.54 >diff -u -r1.54 plugin.xml >--- plugin.xml 17 Jun 2005 15:13:11 -0000 1.54 >+++ plugin.xml 8 Feb 2006 07:54:48 -0000 >@@ -1,6 +1,7 @@ > <?xml version="1.0" encoding="UTF-8"?> > <?eclipse version="3.0"?> > <plugin> >+ <extension-point id="fetchTaskFactories" name="%fetchTaskFactories.name" schema="schema/fetchTaskFactories.exsd"/> > <!-- Tasks --> > <extension > point="org.eclipse.ant.core.antTasks"> >@@ -85,4 +86,14 @@ > </application> > </extension> > >+ <extension >+ point="org.eclipse.pde.build.fetchTaskFactories"> >+ <factory >+ class="org.eclipse.pde.internal.build.fetch.COPYFetchTasksFactory" >+ id="COPY"/> >+ <factory >+ class="org.eclipse.pde.internal.build.fetch.CVSFetchTaskFactory" >+ id="CVS"/> >+ </extension> >+ > </plugin> >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/plugin.properties,v >retrieving revision 1.12 >diff -u -r1.12 plugin.properties >--- plugin.properties 21 Feb 2005 23:31:25 -0000 1.12 >+++ plugin.properties 8 Feb 2006 07:54:48 -0000 >@@ -10,3 +10,6 @@ > ############################################################################### > pluginName = Plug-in Development Environment Build Support > providerName = Eclipse.org >+ >+ >+fetchTaskFactories.name = Fetch Script Task Factories >Index: build.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/build.properties,v >retrieving revision 1.31 >diff -u -r1.31 build.properties >--- build.properties 1 Feb 2006 19:44:56 -0000 1.31 >+++ build.properties 8 Feb 2006 07:54:48 -0000 >@@ -22,6 +22,7 @@ > jars.compile.order = pdebuild.jar,\ > lib/pdebuild-ant.jar > source.pdebuild.jar = src/ >-src.includes = about.html >+src.includes = about.html,\ >+ schema/ > source.lib/pdebuild-ant.jar = src_ant/ > jars.extra.classpath=platform:/plugin/org.apache.ant/lib/ant.jar >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/META-INF/MANIFEST.MF,v >retrieving revision 1.13 >diff -u -r1.13 MANIFEST.MF >--- META-INF/MANIFEST.MF 1 Feb 2006 19:44:56 -0000 1.13 >+++ META-INF/MANIFEST.MF 8 Feb 2006 07:54:48 -0000 >@@ -11,11 +11,15 @@ > org.eclipse.ant.core, > org.eclipse.update.core, > org.eclipse.core.runtime.compatibility;resolution:=optional >-Export-Package: org.eclipse.pde.internal.build;x-friends:="org.eclipse.pde.ui", >+Export-Package: org.eclipse.pde.build, >+ org.eclipse.pde.build.ant, >+ org.eclipse.pde.internal.build;x-friends:="org.eclipse.pde.ui", > org.eclipse.pde.internal.build.ant;x-friends:="org.eclipse.pde.ui", > org.eclipse.pde.internal.build.builder;x-friends:="org.eclipse.pde.ui", >+ org.eclipse.pde.internal.build.fetch;x-friends:="org.eclipse.pde.ui", > org.eclipse.pde.internal.build.packager;x-friends:="org.eclipse.pde.ui", >- org.eclipse.pde.internal.build.site;x-friends:="org.eclipse.pde.ui" >+ org.eclipse.pde.internal.build.site;x-friends:="org.eclipse.pde.ui", >+ org.eclipse.swt.tools.internal > Bundle-Localization: plugin > Eclipse-LazyStart: true > Bundle-RequiredExecutionEnvironment: J2SE-1.4 >Index: src/org/eclipse/pde/internal/build/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/messages.properties,v >retrieving revision 1.39 >diff -u -r1.39 messages.properties >--- src/org/eclipse/pde/internal/build/messages.properties 7 Dec 2005 22:31:20 -0000 1.39 >+++ src/org/eclipse/pde/internal/build/messages.properties 8 Feb 2006 07:54:48 -0000 >@@ -29,7 +29,8 @@ > error_configWrongFormat = {0} is not a valid configuration. > error_missingCustomBuildFile = No custom build file found in {0}. > error_missingSourceFolder = In plugin {0}, the value for property {1} is not set. >- >+error_noRetrieveFeatureTask = No fetch task available for element {0}, check your map files. >+ > ### exception > exception_missingElement = Unable to find element: {0}. > exception_missingFeature = Unable to find feature: {0}. >Index: src/org/eclipse/pde/internal/build/IPDEBuildConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/IPDEBuildConstants.java,v >retrieving revision 1.31 >diff -u -r1.31 IPDEBuildConstants.java >--- src/org/eclipse/pde/internal/build/IPDEBuildConstants.java 1 Feb 2006 18:34:14 -0000 1.31 >+++ src/org/eclipse/pde/internal/build/IPDEBuildConstants.java 8 Feb 2006 07:54:48 -0000 >@@ -113,4 +113,10 @@ > public final static String OSGI_OS = "osgi.os"; //$NON-NLS-1$ > public final static String OSGI_ARCH = "osgi.arch"; //$NON-NLS-1$ > public final static String OSGI_NL = "osgi.nl"; //$NON-NLS-1$ >+ >+ // fetch task extension point >+ public final static String EXT_FETCH_TASK_FACTORIES = "org.eclipse.pde.build.fetchTaskFactories"; //$NON-NLS-1$ >+ public final static String ATTR_ID = "id"; //$NON-NLS-1$ >+ public final static String ATTR_CLASS = "class"; //$NON-NLS-1$ >+ public final static String ELEM_FACTORY = "factory"; //$NON-NLS-1$ > } >Index: src/org/eclipse/pde/internal/build/IXMLConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/IXMLConstants.java,v >retrieving revision 1.62 >diff -u -r1.62 IXMLConstants.java >--- src/org/eclipse/pde/internal/build/IXMLConstants.java 2 Feb 2006 16:55:02 -0000 1.62 >+++ src/org/eclipse/pde/internal/build/IXMLConstants.java 8 Feb 2006 07:54:48 -0000 >@@ -53,7 +53,7 @@ > public static final String TARGET_FETCH_ELEMENT = "fetch.element"; //$NON-NLS-1$ > public static final String TARGET_FETCH_PLUGINS = "fetch.plugins"; //$NON-NLS-1$ > public static final String TARGET_FETCH_RECURSIVELY = "fetch.recursively"; //$NON-NLS-1$ >- public static final String TARGET_GET_FROM_CVS = "getFromCVS"; //$NON-NLS-1$ >+ public static final String TARGET_FETCH_FROM_REPOSITORY = "fetchFromRepository"; //$NON-NLS-1$ > public static final String TARGET_EFFECTIVE_FETCH = "effectiveFetch"; //$NON-NLS-1$ > public static final String TARGET_JARUP = "jarUp"; //$NON-NLS-1$ > public static final String TARGET_JARING = "jarIng"; //$NON-NLS-1$ >Index: src/org/eclipse/pde/internal/build/FetchScriptGenerator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/FetchScriptGenerator.java,v >retrieving revision 1.46 >diff -u -r1.46 FetchScriptGenerator.java >--- src/org/eclipse/pde/internal/build/FetchScriptGenerator.java 18 Jan 2006 22:16:16 -0000 1.46 >+++ src/org/eclipse/pde/internal/build/FetchScriptGenerator.java 8 Feb 2006 07:54:48 -0000 >@@ -15,30 +15,30 @@ > import org.eclipse.ant.core.AntRunner; > import org.eclipse.core.runtime.*; > import org.eclipse.osgi.util.NLS; >+import org.eclipse.pde.build.FetchTaskFactory; >+import org.eclipse.pde.build.ant.AntTask; > import org.eclipse.pde.internal.build.ant.AntScript; >+import org.eclipse.pde.internal.build.fetch.CVSFetchTaskFactory; > import org.eclipse.update.core.*; > import org.eclipse.update.internal.core.FeatureExecutableFactory; > > /** >- * Generates Ant scripts which will use the CVS "fetch" element >- * to retrieve plug-ins and features from the CVS repository. >+ * Generates Ant scripts with a repository specific factory >+ * to retrieve plug-ins and features from a repository. > */ > public class FetchScriptGenerator extends AbstractScriptGenerator { >- private static final String BUNDLE = "bundle"; //$NON-NLS-1$ >- private static final String FRAGMENT = "fragment"; //$NON-NLS-1$ >- private static final String PLUGIN = "plugin"; //$NON-NLS-1$ >- private static final String FEATURE = "feature"; //$NON-NLS-1$ >- private static final String ELEMENT = "element"; //$NON-NLS-1$ >- private static final String TYPE = "type"; //$NON-NLS-1$ >- private static final String PATH = "path"; //$NON-NLS-1$ >- private static final String PASSWORD = "password"; //$NON-NLS-1$ >- private static final String CVSROOT = "cvsRoot"; //$NON-NLS-1$ >- private static final String TAG = "tag"; //$NON-NLS-1$ >+ private static final String BUNDLE = FetchTaskFactory.ELEMENT_TYPE_BUNDLE; >+ private static final String FRAGMENT = FetchTaskFactory.ELEMENT_TYPE_FRAGMENT; >+ private static final String PLUGIN = FetchTaskFactory.ELEMENT_TYPE_PLUGIN; >+ private static final String FEATURE = FetchTaskFactory.ELEMENT_TYPE_FEATURE; >+ private static final String ELEMENT = FetchTaskFactory.KEY_ELEMENT_NAME; >+ private static final String TYPE = FetchTaskFactory.KEY_ELEMENT_TYPE; >+ private static final String FETCH_TASK_FACTORY = FetchTaskFactory.KEY_FACTORY; > > // flag saying if we want to recursively generate the scripts > protected boolean recursiveGeneration = true; > >- // Points to the map files containing references to cvs repository >+ // Points to the map files containing references to repository > protected String directoryLocation; > protected Properties directory; > >@@ -101,15 +101,16 @@ > closeScript(); > } > >- if (recursiveGeneration && mapInfos.get(TYPE).equals(FEATURE)) >+ if (recursiveGeneration && mapInfos.get(TYPE).equals(FEATURE)) > generateFetchFilesForIncludedFeatures(); > > saveRepositoryTags(); >+ FetchTaskFactoriesRegistry.close(); > } > > private void saveRepositoryTags(Properties properties, String fileName) throws CoreException { > try { >- InputStream input = new BufferedInputStream(new FileInputStream(workingDirectory + '/' + fileName)); >+ InputStream input = new BufferedInputStream(new FileInputStream(workingDirectory + '/' + fileName)); > try { > properties.load(input); > } finally { >@@ -131,7 +132,7 @@ > throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_WRITING_FILE, message, null)); > } > } >- >+ > private void saveRepositoryTags() throws CoreException { > saveRepositoryTags(repositoryPluginTags, DEFAULT_PLUGIN_REPOTAG_FILENAME_DESCRIPTOR); > saveRepositoryTags(repositoryFeatureTags, DEFAULT_FEATURE_REPOTAG_FILENAME_DESCRIPTOR); >@@ -169,11 +170,12 @@ > generatePrologue(); > generateFetchTarget(); > generateFetchElementTarget(); >- if (mapInfos.get(TYPE).equals(FEATURE)) { >+ if (mapInfos.get(TYPE).equals(FEATURE)) { > generateFetchPluginsTarget(); > generateFetchRecusivelyTarget(); > } >- generateGetFromCVSTarget(); >+ generateGetFromRepositoryTarget(); >+ generateAdditionalTargets(); > generateEpilogue(); > } > >@@ -184,7 +186,7 @@ > script.println(); > script.printTargetDeclaration(TARGET_FETCH, null, null, null, null); > script.printAntCallTask(TARGET_FETCH_ELEMENT, null, null); >- if (mapInfos.get(TYPE).equals(FEATURE)) { >+ if (mapInfos.get(TYPE).equals(FEATURE)) { > script.printAntCallTask(TARGET_FETCH_PLUGINS, null, null); > script.printAntCallTask(TARGET_FETCH_RECURSIVELY, null, null); > } >@@ -204,7 +206,7 @@ > > protected void generateFetchPluginsTarget() throws CoreException { > script.printTargetDeclaration(TARGET_FETCH_PLUGINS, null, FEATURE_AND_PLUGINS, null, null); >- retrieveFeature((String) mapInfos.get(ELEMENT), (String) mapInfos.get(CVSROOT), (String) mapInfos.get(TAG), (String) mapInfos.get(PASSWORD), (String) mapInfos.get(PATH)); >+ retrieveFeature((String) mapInfos.get(ELEMENT), (String) mapInfos.get(TYPE), mapInfos); > generateChildrenFetchScript(); > script.printTargetEnd(); > } >@@ -219,28 +221,57 @@ > private Map processMapFileEntry(String entry) throws CoreException { > Map entryInfos = new HashMap(5); > >- String cvsInfo = getCVSInfo(entry); >- if (cvsInfo == null) { >+ // extract type and element from entry >+ int index = entry.indexOf('@'); >+ String type = entry.substring(0, index); >+ String currentElement = entry.substring(index + 1); >+ >+ // read and validate the repository info >+ String repositoryInfo = getRepositoryInfo(entry); >+ if (repositoryInfo == null) { > String message = NLS.bind(Messages.error_missingDirectoryEntry, entry); > BundleHelper.getDefault().getLog().log(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_ENTRY_MISSING, message, null)); > return null; > } > >- String[] cvsFields = Utils.getArrayFromStringWithBlank(cvsInfo, ","); //$NON-NLS-1$ >- if (cvsFields.length < 2) { >- String message = NLS.bind(Messages.error_incorrectDirectoryEntry, element); >+ // collect and validate the repository info >+ String[] repositoryFields = Utils.getArrayFromStringWithBlank(repositoryInfo, ","); //$NON-NLS-1$ >+ if (repositoryFields.length < 2) { >+ String message = NLS.bind(Messages.error_incorrectDirectoryEntry, currentElement); > throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_ENTRY_MISSING, message, null)); > } > >- entryInfos.put(TAG, fetchTag.length() == 0 ? cvsFields[0] : fetchTag); >- entryInfos.put(CVSROOT, cvsFields[1]); >- entryInfos.put(PASSWORD, (cvsFields.length > 2 && !cvsFields[2].equals("")) ? cvsFields[2] : null); //$NON-NLS-1$ >- >- entryInfos.put(PATH, (cvsFields.length > 3 && !cvsFields[3].equals("")) ? cvsFields[3] : null); //$NON-NLS-1$ >- >- int index = entry.indexOf('@'); >- entryInfos.put(TYPE, entry.substring(0, index)); >- entryInfos.put(ELEMENT, entry.substring(index + 1)); >+ // determine fetch script builder >+ FetchTaskFactory fetchTaskFactory = null; >+ String[] arguments = null; >+ >+ // check if first repository field matches a builder id >+ if (FetchTaskFactoriesRegistry.getRegistry().getFactoryIds().contains(repositoryFields[0])) { >+ fetchTaskFactory = FetchTaskFactoriesRegistry.getRegistry().getFactory(repositoryFields[0]); >+ >+ // construct arguments array for registered builder >+ arguments = new String[repositoryFields.length - 1]; >+ System.arraycopy(repositoryFields, 1, arguments, 0, repositoryFields.length - 1); >+ } >+ >+ // default to CVS builder (to be compatible) >+ if (null == fetchTaskFactory) { >+ // fall back to CVS >+ fetchTaskFactory = new CVSFetchTaskFactory(); >+ >+ // construct arguments array for CVS builder >+ arguments = repositoryFields; >+ } >+ >+ // add infos from registered builder >+ fetchTaskFactory.processMapFileEntry(currentElement, type, arguments, fetchTag, entryInfos); >+ >+ // store builder >+ entryInfos.put(FETCH_TASK_FACTORY, fetchTaskFactory); >+ >+ // add general infos (will override builder specific infos) >+ entryInfos.put(TYPE, type); >+ entryInfos.put(ELEMENT, currentElement); > return entryInfos; > } > >@@ -257,9 +288,9 @@ > } > continue; > } >- >+ > //Included features can be available in the baseLocation. >- if (getCVSInfo(FEATURE + '@' + featureId) != null) >+ if (getRepositoryInfo(FEATURE + '@' + featureId) != null) > script.printAntTask(Utils.getPropertyFormat(PROPERTY_BUILD_DIRECTORY) + '/' + FETCH_FILE_PREFIX + featureId + ".xml", null, TARGET_FETCH, null, null, null); //$NON-NLS-1$ > else if (getSite(false).findFeature(featureId, null, false) == null) { > String message = NLS.bind(Messages.error_cannotFetchNorFindFeature, featureId); >@@ -277,57 +308,64 @@ > return false; > } > >- String password = (String) mapFileEntry.get(PASSWORD); >- if (password != null) >- script.printCVSPassTask((String) mapFileEntry.get(CVSROOT), password, cvsPassFileLocation); >- >+ FetchTaskFactory factory = (FetchTaskFactory) mapFileEntry.get(FETCH_TASK_FACTORY); >+ String elementToFetch = (String) mapFileEntry.get(ELEMENT); > String type = (String) mapFileEntry.get(TYPE); >+ >+ // print authentification task if one is provided >+ AntTask authTask = factory.generateAuthentificationAntTask(elementToFetch, type, mapFileEntry); >+ if (null != authTask) >+ script.print(authTask); >+ >+ // the location > String location = getElementLocation(type); >- Map params = new HashMap(5); > >- //We directly export the CVS content into the correct directory >- params.put("destination", mapFileEntry.get(ELEMENT)); //$NON-NLS-1$ >- params.put(TAG, mapFileEntry.get(TAG)); >- params.put(CVSROOT, mapFileEntry.get(CVSROOT)); >- params.put("quiet", "${quiet}"); //$NON-NLS-1$ //$NON-NLS-2$ >+ // the destination >+ // we directly export the content into the correct directory >+ String destination = elementToFetch; >+ >+ // get params from builder >+ Map params = new HashMap(factory.generatePropertiesForFetchTask(elementToFetch, type, mapFileEntry, destination, manifestFileOnly)); > >- String cvsPackage = ((String) mapFileEntry.get(PATH) == null ? (String) mapFileEntry.get(ELEMENT) : (String) mapFileEntry.get(PATH)); > String fullLocation = null; > if (type.equals(FEATURE)) { >- fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_FEATURE_FILENAME_DESCRIPTOR; >+ fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_FEATURE_FILENAME_DESCRIPTOR; > params.put("fileToCheck", fullLocation); //$NON-NLS-1$ >- cvsPackage += manifestFileOnly ? '/' + DEFAULT_FEATURE_FILENAME_DESCRIPTOR : ""; //$NON-NLS-1$ >- repositoryFeatureTags.put(mapFileEntry.get(ELEMENT), mapFileEntry.get(TAG)); >+ repositoryFeatureTags.put(elementToFetch, factory.getTagToFetch(elementToFetch, type, mapFileEntry)); > } else if (type.equals(PLUGIN)) { >- fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_PLUGIN_FILENAME_DESCRIPTOR; >+ fullLocation = location + '/' + elementToFetch + '/' + DEFAULT_PLUGIN_FILENAME_DESCRIPTOR; > params.put("fileToCheck", fullLocation); //$NON-NLS-1$ >- cvsPackage += manifestFileOnly ? '/' + DEFAULT_PLUGIN_FILENAME_DESCRIPTOR : ""; //$NON-NLS-1$ >- repositoryPluginTags.put(mapFileEntry.get(ELEMENT), mapFileEntry.get(TAG)); >+ repositoryPluginTags.put(elementToFetch, factory.getTagToFetch(elementToFetch, type, mapFileEntry)); > } else if (type.equals(FRAGMENT)) { >- fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR; >+ fullLocation = location + '/' + elementToFetch + '/' + DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR; > params.put("fileToCheck", fullLocation); //$NON-NLS-1$ >- cvsPackage += manifestFileOnly ? '/' + DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR : ""; //$NON-NLS-1$ >- repositoryPluginTags.put(mapFileEntry.get(ELEMENT), mapFileEntry.get(TAG)); >+ repositoryPluginTags.put(elementToFetch, factory.getTagToFetch(elementToFetch, type, mapFileEntry)); > } else if (type.equals(BUNDLE)) { > fullLocation = location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_BUNDLE_FILENAME_DESCRIPTOR; > params.put("fileToCheck", fullLocation); //$NON-NLS-1$ >- cvsPackage += manifestFileOnly ? '/' + DEFAULT_BUNDLE_FILENAME_DESCRIPTOR : "";//$NON-NLS-1$ >- repositoryPluginTags.put(mapFileEntry.get(ELEMENT), mapFileEntry.get(TAG)); >+ repositoryPluginTags.put(elementToFetch, factory.getTagToFetch(elementToFetch, type, mapFileEntry)); > } >- params.put("package", cvsPackage); //$NON-NLS-1$ > > // This call create a new property for every feature, plugins or fragments that we must check the existence of > script.printAvailableTask(fullLocation, fullLocation); > if (type.equals(PLUGIN) || type.equals(FRAGMENT)) { >- script.printAvailableTask(fullLocation, location + '/' + (String) mapFileEntry.get(ELEMENT) + '/' + DEFAULT_BUNDLE_FILENAME_DESCRIPTOR); >+ script.printAvailableTask(fullLocation, location + '/' + elementToFetch + '/' + DEFAULT_BUNDLE_FILENAME_DESCRIPTOR); > } >- script.printAntTask("../" + scriptName, Utils.getPropertyFormat(PROPERTY_BUILD_DIRECTORY) + '/' + (type.equals(FEATURE) ? DEFAULT_FEATURE_LOCATION : DEFAULT_PLUGIN_LOCATION), TARGET_GET_FROM_CVS, null, null, params); //$NON-NLS-1$ >+ script.printAntTask("../" + scriptName, Utils.getPropertyFormat(PROPERTY_BUILD_DIRECTORY) + '/' + (type.equals(FEATURE) ? DEFAULT_FEATURE_LOCATION : DEFAULT_PLUGIN_LOCATION), TARGET_FETCH_FROM_REPOSITORY, null, null, params); //$NON-NLS-1$ > return true; > } > >- protected void generateGetFromCVSTarget() { >- script.printTargetDeclaration(TARGET_GET_FROM_CVS, null, null, "${fileToCheck}", "{destination}"); //$NON-NLS-1$ //$NON-NLS-2$ >- script.printCVSTask("export -d ${destination} -r ${tag} ${package}", "${cvsRoot}", null, null, null, "${quiet}", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ protected void generateGetFromRepositoryTarget() { >+ script.printTargetDeclaration(TARGET_FETCH_FROM_REPOSITORY, null, null, "${fileToCheck}", null); //$NON-NLS-1$ >+ if (null != mapInfos) { >+ FetchTaskFactory factory = (FetchTaskFactory) mapInfos.get(FETCH_TASK_FACTORY); >+ if (null != factory) { >+ AntTask getTask = factory.getFetchAntTask(); >+ if (null != getTask) { >+ script.print(getTask); >+ } >+ } >+ } > script.printTargetEnd(); > } > >@@ -365,11 +403,11 @@ > > boolean generated = true; > if (allChildren[i].isFragment()) >- generated = generateFetchEntry(FRAGMENT + '@' + elementId, !Utils.isIn(compiledChildren, allChildren[i])); >+ generated = generateFetchEntry(FRAGMENT + '@' + elementId, !Utils.isIn(compiledChildren, allChildren[i])); > else >- generated = generateFetchEntry(PLUGIN + '@' + elementId, !Utils.isIn(compiledChildren, allChildren[i])); >+ generated = generateFetchEntry(PLUGIN + '@' + elementId, !Utils.isIn(compiledChildren, allChildren[i])); > if (generated == false) >- generateFetchEntry(BUNDLE + '@' + elementId, !Utils.isIn(compiledChildren, allChildren[i])); >+ generateFetchEntry(BUNDLE + '@' + elementId, !Utils.isIn(compiledChildren, allChildren[i])); > } > } > >@@ -379,37 +417,30 @@ > * constructor from Update. > * > * @param elementName the feature to retrieve >- * @param cvsRoot the root in CVS >- * @param tag the CVS tag >- * @param password the CVS password >+ * @param elementType the element type >+ * @param elementInfos the element information > * @throws CoreException > */ >- protected void retrieveFeature(String elementName, String cvsRoot, String tag, String password, String path) throws CoreException { >+ protected void retrieveFeature(String elementName, String elementType, Map elementInfos) throws CoreException { > // Generate a temporary Ant script which retrieves the feature.xml for this > // feature from CVS > File root = new File(workingDirectory); >- File target = new File(root, DEFAULT_RETRIEVE_FILENAME_DESCRIPTOR); >+ File target = new File(root, DEFAULT_RETRIEVE_FILENAME_DESCRIPTOR); > try { > AntScript retrieve = new AntScript(new FileOutputStream(target)); > try { > retrieve.printProjectDeclaration("RetrieveFeature", "main", "."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- retrieve.printTargetDeclaration(TARGET_MAIN, null, null, null, null); >+ retrieve.printTargetDeclaration(TARGET_MAIN, null, null, null, null); > >- IPath moduleFeatureFile; >- IPath moduleFeatureProperties; >- if (path != null) { >- moduleFeatureFile = new Path(path).append(DEFAULT_FEATURE_FILENAME_DESCRIPTOR); >- moduleFeatureProperties = new Path(path).append(PROPERTIES_FILE); >- } else { >- moduleFeatureFile = new Path(elementName).append(DEFAULT_FEATURE_FILENAME_DESCRIPTOR); >- moduleFeatureProperties = new Path(elementName).append(PROPERTIES_FILE); >+ String destination = elementName; >+ String[] files = new String[] {DEFAULT_FEATURE_FILENAME_DESCRIPTOR, PROPERTIES_FILE}; >+ FetchTaskFactory factory = (FetchTaskFactory) elementInfos.get(FETCH_TASK_FACTORY); >+ AntTask retrieveFeatureTask = factory.generateRetrieveFilesAntTask(elementName, elementType, elementInfos, destination, files); >+ if (null == retrieveFeatureTask) { >+ String message = NLS.bind(Messages.error_noRetrieveFeatureTask, elementName); >+ throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_ENTRY_MISSING, message, null)); > } >- >- if (password != null) >- retrieve.printCVSPassTask(cvsRoot, password, cvsPassFileLocation); >- >- retrieve.printCVSTask("export -r " + tag + " " + moduleFeatureFile.toString(), cvsRoot, null, null, null, "true", null); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ >- retrieve.printCVSTask("export -r " + tag + " " + moduleFeatureProperties.toString(), cvsRoot, null, null, null, "true", null); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ >+ retrieve.print(retrieveFeatureTask); > > retrieve.printTargetEnd(); > retrieve.printProjectEnd(); >@@ -427,14 +458,15 @@ > AntRunner runner = new AntRunner(); > runner.setBuildFileLocation(target.getAbsolutePath()); > runner.run(); >+ String destination = elementName; > FeatureExecutableFactory factory = new FeatureExecutableFactory(); >- File featureFolder = new File(root, (path == null ? elementName : path)); >+ File featureFolder = new File(root, destination); > feature = factory.createFeature(featureFolder.toURL(), null, null); > > //We only delete here, so if an exception is thrown the user can still see the retrieve.xml > target.delete(); > featureProperties = new Properties(); >- InputStream featureStream = new FileInputStream(new File(root, (path == null ? elementName : path) + '/' + PROPERTIES_FILE)); >+ InputStream featureStream = new FileInputStream(new File(root, destination + '/' + PROPERTIES_FILE)); > featureProperties.load(featureStream); > featureStream.close(); > clear(featureFolder); >@@ -484,7 +516,7 @@ > */ > protected String getElementLocation(String type) { > IPath location = new Path(Utils.getPropertyFormat(PROPERTY_BUILD_DIRECTORY)); >- if (type.equals(FEATURE)) >+ if (type.equals(FEATURE)) > location = location.append(DEFAULT_FEATURE_LOCATION); > else > location = location.append(DEFAULT_PLUGIN_LOCATION); >@@ -498,7 +530,7 @@ > * @return String > * @throws CoreException > */ >- protected String getCVSInfo(String elementName) throws CoreException { >+ protected String getRepositoryInfo(String elementName) throws CoreException { > if (directory == null) > directory = readProperties(directoryLocation, "", IStatus.ERROR); //$NON-NLS-1$ > return directory.getProperty(elementName); >@@ -524,6 +556,21 @@ > } > > /** >+ * Generates additional targets submitted by the fetch task factory. >+ */ >+ private void generateAdditionalTargets() { >+ if (null != mapInfos) { >+ FetchTaskFactory factory = (FetchTaskFactory) mapInfos.get(FETCH_TASK_FACTORY); >+ if (null != factory) { >+ AntTask additionalTasks = factory.getAdditionalTasks(); >+ if (null != additionalTasks) { >+ script.print(additionalTasks); >+ } >+ } >+ } >+ } >+ >+ /** > * Set the directory location to be the given value. > * > * @param directoryLocation >Index: src/org/eclipse/pde/internal/build/Messages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/Messages.java,v >retrieving revision 1.9 >diff -u -r1.9 Messages.java >--- src/org/eclipse/pde/internal/build/Messages.java 7 Dec 2005 22:31:20 -0000 1.9 >+++ src/org/eclipse/pde/internal/build/Messages.java 8 Feb 2006 07:54:48 -0000 >@@ -33,7 +33,8 @@ > public static String error_configWrongFormat; > public static String error_missingCustomBuildFile; > public static String error_missingSourceFolder; >- >+ public static String error_noRetrieveFeatureTask; >+ > // exception > public static String exception_missingElement; > public static String exception_missingFeature; >Index: src/org/eclipse/pde/internal/build/fetch/CVSFetchTaskFactory.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/build/fetch/CVSFetchTaskFactory.java >diff -N src/org/eclipse/pde/internal/build/fetch/CVSFetchTaskFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/build/fetch/CVSFetchTaskFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,138 @@ >+/********************************************************************** >+ * Copyright (c) 2000, 2006 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ * Gunnar Wagenknecht - adaption to new fetch script builder API >+ **********************************************************************/ >+package org.eclipse.pde.internal.build.fetch; >+ >+import java.util.HashMap; >+import java.util.Map; >+import org.eclipse.core.runtime.*; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.pde.build.FetchTaskFactory; >+import org.eclipse.pde.build.ant.AntTask; >+import org.eclipse.pde.build.ant.IAntScript; >+import org.eclipse.pde.internal.build.IPDEBuildConstants; >+import org.eclipse.pde.internal.build.Messages; >+import org.eclipse.pde.internal.build.ant.AntScript; >+ >+/** >+ * An <code>FetchTaskFactory</code> for building fetch scripts that will >+ * fetch content from a CVS repository (id: <code>CVS</code>). >+ * <p> >+ * Map file arguments: >+ * <code><TAG>,<CVSROOT>[,<PASSWORD>[,<PATH>[,<CVSPASSFILE>]]]</code> >+ * </p> >+ */ >+public class CVSFetchTaskFactory extends FetchTaskFactory implements IPDEBuildConstants { >+ public static final String ID = "CVS"; //$NON-NLS-1$ >+ >+ private static final String CVSPASSFILE = "cvsPassFile"; //$NON-NLS-1$ >+ private static final String CVSROOT = "cvsRoot"; //$NON-NLS-1$ >+ private static final String PASSWORD = "password"; //$NON-NLS-1$ >+ private static final String PATH = "path"; //$NON-NLS-1$ >+ private static final String TAG = "tag"; //$NON-NLS-1$ >+ >+ private static final AntTask GET_FROM_CVS_TASK = new AntTask() { >+ public void print(IAntScript antScript) { >+ AntScript script = (AntScript) antScript; >+ script.printCVSTask("export -d ${destination} -r ${tag} ${package}", "${cvsRoot}", null, null, null, "${quiet}", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ } >+ }; >+ >+ public AntTask generateAuthentificationAntTask(final String element, final String type, final Map entryInfos) { >+ return new AntTask() { >+ public void print(IAntScript antScript) { >+ AntScript script = (AntScript) antScript; >+ String password = (String) entryInfos.get(PASSWORD); >+ String cvsPassFileLocation = (String) entryInfos.get(CVSPASSFILE); >+ if (password != null) >+ script.printCVSPassTask((String) entryInfos.get(CVSROOT), password, cvsPassFileLocation); >+ } >+ }; >+ } >+ >+ public Map generatePropertiesForFetchTask(String element, String type, Map entryInfos, String destination, boolean manifestFileOnly) { >+ Map params = new HashMap(5); >+ >+ // we directly export the CVS content into the destination >+ params.put("destination", destination); //$NON-NLS-1$ >+ params.put(TAG, entryInfos.get(TAG)); >+ params.put(CVSROOT, entryInfos.get(CVSROOT)); >+ params.put("quiet", "${quiet}"); //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ String cvsPackage = ((String) entryInfos.get(PATH) == null ? element : (String) entryInfos.get(PATH)); >+ if (type.equals(ELEMENT_TYPE_FEATURE)) { >+ cvsPackage += manifestFileOnly ? '/' + DEFAULT_FEATURE_FILENAME_DESCRIPTOR : ""; //$NON-NLS-1$ >+ } else if (type.equals(ELEMENT_TYPE_PLUGIN)) { >+ cvsPackage += manifestFileOnly ? '/' + DEFAULT_PLUGIN_FILENAME_DESCRIPTOR : ""; //$NON-NLS-1$ >+ } else if (type.equals(ELEMENT_TYPE_FRAGMENT)) { >+ cvsPackage += manifestFileOnly ? '/' + DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR : ""; //$NON-NLS-1$ >+ } else if (type.equals(ELEMENT_TYPE_BUNDLE)) { >+ cvsPackage += manifestFileOnly ? '/' + DEFAULT_BUNDLE_FILENAME_DESCRIPTOR : "";//$NON-NLS-1$ >+ } >+ params.put("package", cvsPackage); //$NON-NLS-1$ >+ >+ return params; >+ } >+ >+ public AntTask generateRetrieveFilesAntTask(final String element, final String type, final Map entryInfos, final String destination, final String[] files) { >+ return new AntTask() { >+ public void print(IAntScript antScript) { >+ AntScript script = (AntScript) antScript; >+ String cvsRoot = (String) entryInfos.get(CVSROOT); >+ String tag = (String) entryInfos.get(TAG); >+ String path = (String) entryInfos.get(PATH); >+ String password = (String) entryInfos.get(PASSWORD); >+ String cvsPassFileLocation = (String) entryInfos.get(CVSPASSFILE); >+ >+ if (password != null) >+ script.printCVSPassTask(cvsRoot, password, cvsPassFileLocation); >+ >+ for (int i = 0; i < files.length; i++) { >+ String file = files[i]; >+ IPath filePath; >+ if (path != null) { >+ filePath = new Path(path).append(file); >+ } else { >+ filePath = new Path(element).append(file); >+ } >+ >+ script.printCVSTask("export -d " + destination + " -r " + tag + " " + filePath.toString(), cvsRoot, null, null, null, "true", null); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ >+ } >+ } >+ }; >+ } >+ >+ public AntTask getAdditionalTasks() { >+ return null; >+ } >+ >+ public AntTask getFetchAntTask() { >+ return GET_FROM_CVS_TASK; >+ } >+ >+ public String getTagToFetch(String element, String type, Map entryInfos) { >+ return (String) entryInfos.get(TAG); >+ } >+ >+ public void processMapFileEntry(String element, String type, String[] arguments, String fetchTag, Map entryInfos) throws CoreException { >+ if (arguments.length < 2) { >+ String message = NLS.bind(Messages.error_incorrectDirectoryEntry, element); >+ throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_ENTRY_MISSING, message, null)); >+ } >+ >+ entryInfos.put(CVSPASSFILE, (arguments.length > 4 && !arguments[4].equals("")) ? arguments[4] : null); //$NON-NLS-1$ >+ entryInfos.put(TAG, (null == fetchTag || fetchTag.trim().length() == 0) ? arguments[0] : fetchTag); >+ entryInfos.put(CVSROOT, arguments[1]); >+ entryInfos.put(PASSWORD, (arguments.length > 2 && !arguments[2].equals("")) ? arguments[2] : null); //$NON-NLS-1$ >+ >+ entryInfos.put(PATH, (arguments.length > 3 && !arguments[3].equals("")) ? arguments[3] : null); //$NON-NLS-1$ >+ } >+} >Index: src/org/eclipse/pde/build/ant/IAntScript.java >=================================================================== >RCS file: src/org/eclipse/pde/build/ant/IAntScript.java >diff -N src/org/eclipse/pde/build/ant/IAntScript.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/build/ant/IAntScript.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,47 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2006 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.build.ant; >+ >+/** >+ * An interface for producing Ant scripts. >+ * <p> >+ * It contains convenience methods for creating the XML elements >+ * required for Ant scripts. See the <a href="http://jakarta.apache.org/ant">Ant</a> >+ * website for more details on Ant scripts and the particular Ant tasks. >+ * </p> >+ * <p> >+ * This interface is not intended to be implemented by clients. >+ * </p> >+ * @see AntTask >+ */ >+public interface IAntScript { >+ >+ /** >+ * Print the given string to the Ant script. >+ * >+ * @param string >+ */ >+ public abstract void print(String string); >+ >+ /** >+ * Print the given comment to the Ant script. >+ * >+ * @param comment the comment to write out >+ */ >+ public abstract void printComment(String comment); >+ >+ /** >+ * Print the given string to the Ant script followed by a carriage-return. >+ * >+ * @param string the string to print >+ */ >+ public abstract void println(String string); >+} >Index: src/org/eclipse/pde/internal/build/fetch/COPYFetchTasksFactory.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/build/fetch/COPYFetchTasksFactory.java >diff -N src/org/eclipse/pde/internal/build/fetch/COPYFetchTasksFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/build/fetch/COPYFetchTasksFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,140 @@ >+/********************************************************************** >+ * Copyright (c) 2004, 2006 Eclipse Foundation 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Gunnar Wagenknecht - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.pde.internal.build.fetch; >+ >+import java.util.HashMap; >+import java.util.Map; >+import org.eclipse.core.runtime.*; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.pde.build.FetchTaskFactory; >+import org.eclipse.pde.build.ant.AntTask; >+import org.eclipse.pde.build.ant.IAntScript; >+import org.eclipse.pde.internal.build.IPDEBuildConstants; >+import org.eclipse.pde.internal.build.Messages; >+import org.eclipse.pde.internal.build.ant.*; >+ >+/** >+ * An <code>FetchTaskFactory</code> that fetches features and plugins by >+ * copying from a specific location (id: <code>COPY</code>). >+ * <p> >+ * Map file arguments: >+ * <code><ROOT_LOCATION>[,<ELEMENT_LOCATION>]</code> >+ * <dl> >+ * <dt>ROOT_LOCATION</dt> >+ * <dd>The ROOT_LOCATION (eg. <code>/source/eclipse</code>, or >+ * <code>D:/dev/myproduct</code>) is used as root path to determine the >+ * location to fetch. It can be overwritten via the >+ * <code>fetchTag</code> to fetch from another location (for example, on a different machine).</dd> >+ * </dl> >+ * <dt>ELEMENT_LOCATION</dt> >+ * <dd>A path withing the ROOT_LOCATION (eg. >+ * <code>org.eclipse.sdk-feature/features/org.eclipse.rcp</code>) to retrive >+ * the element from if it is not within the root. If this is not provided the >+ * default path will be used which simply maps to the element name.</dd> >+ * </dl> >+ * </p> >+ */ >+public class COPYFetchTasksFactory extends FetchTaskFactory implements IPDEBuildConstants { >+ >+ public static final String ID = "COPY"; //$NON-NLS-1$ >+ >+ private static final String PATH = "path"; //$NON-NLS-1$ >+ private static final String ROOT = "root"; //$NON-NLS-1$ >+ >+ private static final AntTask GET_FROM_PATH_TASK = new AntTask() { >+ public void print(IAntScript antScript) { >+ AntScript script = (AntScript) antScript; >+ FileSet dir = new FileSet("${sourcePath}", null, null, null, null, null, null); //$NON-NLS-1$ >+ script.printCopyTask(null, "${destination}", new FileSet[] {dir}, false, true); //$NON-NLS-1$ >+ } >+ }; >+ >+ public AntTask generateAuthentificationAntTask(String element, String type, Map entryInfos) { >+ // not necessary >+ return null; >+ } >+ >+ public Map generatePropertiesForFetchTask(String element, String type, Map entryInfos, String destination, boolean xmlFileOnly) { >+ Map params = new HashMap(2); >+ >+ // we directly export the CVS content into the destination >+ params.put("destination", destination); //$NON-NLS-1$ >+ params.put("quiet", "${quiet}"); //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ String root = (String) entryInfos.get(ROOT); >+ String path = (String) entryInfos.get(PATH); >+ IPath sourcePath = new Path(root); >+ if (path != null) { >+ sourcePath = sourcePath.append(path); >+ } else { >+ sourcePath = sourcePath.append(element); >+ } >+ >+ if (xmlFileOnly) { >+ if (type.equals("feature")) { //$NON-NLS-1$ >+ sourcePath.append(DEFAULT_FEATURE_FILENAME_DESCRIPTOR); >+ } else if (type.equals("plugin")) { //$NON-NLS-1$ >+ sourcePath.append(DEFAULT_PLUGIN_FILENAME_DESCRIPTOR); >+ } else if (type.equals("fragment")) { //$NON-NLS-1$ >+ sourcePath.append(DEFAULT_FRAGMENT_FILENAME_DESCRIPTOR); >+ } >+ } >+ params.put("sourcePath", sourcePath.toString()); //$NON-NLS-1$ >+ >+ return params; >+ } >+ >+ public AntTask generateRetrieveFilesAntTask(final String element, final String type, final Map entryInfos, final String destination, final String[] files) { >+ return new AntTask() { >+ public void print(IAntScript antScript) { >+ AntScript script = (AntScript) antScript; >+ String root = (String) entryInfos.get(ROOT); >+ String path = (String) entryInfos.get(PATH); >+ >+ for (int i = 0; i < files.length; i++) { >+ String file = files[i]; >+ IPath filePath = new Path(root); >+ if (path != null) { >+ filePath = filePath.append(path).append(file); >+ } else { >+ filePath = filePath.append(element).append(file); >+ } >+ >+ script.printCopyTask(filePath.toString(), destination, null, false, true); >+ } >+ } >+ }; >+ } >+ >+ public AntTask getAdditionalTasks() { >+ return null; >+ } >+ >+ public AntTask getFetchAntTask() { >+ return GET_FROM_PATH_TASK; >+ } >+ >+ public String getTagToFetch(String element, String type, Map entryInfos) { >+ return (String) entryInfos.get(ROOT); >+ } >+ >+ public void processMapFileEntry(String element, String type, String[] arguments, String fetchTag, Map entryInfos) throws CoreException { >+ >+ if (arguments.length < 1) { >+ String message = NLS.bind(Messages.error_incorrectDirectoryEntry, element); >+ throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_ENTRY_MISSING, message, null)); >+ } >+ >+ entryInfos.put(ROOT, (null == fetchTag || fetchTag.trim().length() == 0) ? arguments[0] : fetchTag); >+ entryInfos.put(PATH, (arguments.length > 1 && arguments[1].trim().length() > 0) ? arguments[1] : null); >+ } >+ >+} >Index: schema/fetchTaskFactories.exsd >=================================================================== >RCS file: schema/fetchTaskFactories.exsd >diff -N schema/fetchTaskFactories.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/fetchTaskFactories.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,130 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.pde.build"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.pde.build" id="fetchScriptBuilders" name="Fetch Script Builder"/> >+ </appInfo> >+ <documentation> >+ This extension point provides factories for constructing repository specific fetch script tasks during the PDE Build fetch process. >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <complexType> >+ <sequence> >+ <element ref="factory" minOccurs="1" maxOccurs="unbounded"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="factory"> >+ <annotation> >+ <appInfo> >+ <meta.element labelAttribute="id"/> >+ </appInfo> >+ <documentation> >+ Defines a fetch task factory. >+ </documentation> >+ </annotation> >+ <complexType> >+ <attribute name="id" type="string" use="required"> >+ <annotation> >+ <documentation> >+ The factory id (must be unique). >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ The factory implementation (must extend <code>org.eclipse.pde.build.FetchTaskFactory</code> and must provide a parameter less, public constructor). >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn="org.eclipse.pde.build.FetchTaskFactory"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ 3.2 >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ <pre> >+<extension point="org.eclipse.pde.build.fetchTaskFactories"> >+ <factory >+ class="org.eclipse.pde.internal.build.fetch.COPYFetchTasksFactory" >+ id="COPY"/> >+ <factory >+ class="org.eclipse.pde.internal.build.fetch.CVSFetchTaskFactory" >+ id="CVS"/> >+</extension> >+</pre> >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiInfo"/> >+ </appInfo> >+ <documentation> >+ A fetch task factory must extend <code>org.eclipse.pde.build.FetchTaskFactory</code> and must provide a parameter less, public constructor. >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="implementation"/> >+ </appInfo> >+ <documentation> >+ The following fetch task factories are provided by PDE Build. >+<ul> >+<li>a CVS fetch task factroy for fetching features and plug-ins from CVS repositories</li> >+<li>a COPY fetch task factory for copying features and plug-ins from arbitrary file system locations</li> >+</ul> >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="copyright"/> >+ </appInfo> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ >+</schema> >Index: src/org/eclipse/pde/build/FetchTaskFactory.java >=================================================================== >RCS file: src/org/eclipse/pde/build/FetchTaskFactory.java >diff -N src/org/eclipse/pde/build/FetchTaskFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/build/FetchTaskFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,241 @@ >+/********************************************************************** >+ * Copyright (c) 2004, 2006 Eclipse Foundation 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Gunnar Wagenknecht - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.pde.build; >+ >+import java.util.Map; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.pde.build.ant.AntTask; >+ >+/** >+ * A <code>FetchTaskFactory</code> constructs a repository specific fetch >+ * script for the PDE build process. >+ * <p> >+ * It is registered via the >+ * <code>org.eclipse.pde.build.fetchScriptBuilder</code> extension point. >+ * </p> >+ * @since 3.2 >+ */ >+public abstract class FetchTaskFactory { >+ >+ /** element type <code>bundle</code> */ >+ public static final String ELEMENT_TYPE_BUNDLE = "bundle"; //$NON-NLS-1$ >+ >+ /** element type <code>feature</code> */ >+ public static final String ELEMENT_TYPE_FEATURE = "feature"; //$NON-NLS-1$ >+ >+ /** element type <code>fragment</code> */ >+ public static final String ELEMENT_TYPE_FRAGMENT = "fragment"; //$NON-NLS-1$ >+ >+ /** element type <code>plugin</code> */ >+ public static final String ELEMENT_TYPE_PLUGIN = "plugin"; //$NON-NLS-1$ >+ >+ /** map key of the element type (value <code>type</code>) */ >+ public static final String KEY_ELEMENT_TYPE = "type"; //$NON-NLS-1$ >+ >+ /** map key of the element name (value <code>element</code>) */ >+ public static final String KEY_ELEMENT_NAME = "element"; //$NON-NLS-1$ >+ >+ /** map key of the fetch task factory (value <code>factory</code>) */ >+ public static final String KEY_FACTORY = "factory"; //$NON-NLS-1$ >+ >+ /** >+ * Generates an ANT task that is necessary for authentificate against the >+ * repository. >+ * <p> >+ * Note that this task is wrapped into an Ant target by the caller. >+ * The implementor is NOT allowed to create Ant targets inside the returned task. >+ * See the <a href="http://jakarta.apache.org/ant">Ant</a> >+ * website for more details on Ant scripts and Ant tasks. >+ * </p> >+ * >+ * @param element >+ * the element name >+ * @param type >+ * the element type (one of >+ * {@link #ELEMENT_TYPE_FEATURE <code>feature</code>}, >+ * {@link #ELEMENT_TYPE_PLUGIN <code>plugin</code>}, >+ * {@link #ELEMENT_TYPE_FRAGMENT <code>fragment</code>} or >+ * {@link #ELEMENT_TYPE_BUNDLE <code>bundle</code>}) (may not be >+ * <code>null</code>) >+ * @param entryInfos >+ * the map with detailed information collected in >+ * {@link #processMapFileEntry(String, String, String[], String, Map)}, >+ * additional keys that are set by PDE Build are: >+ * {@link #KEY_ELEMENT_NAME}, >+ * {@link #KEY_ELEMENT_TYPE} and >+ * {@link #KEY_FACTORY} >+ * @return the authentification task (maybe <code>null</code> if not >+ * necessary) >+ */ >+ public abstract AntTask generateAuthentificationAntTask(String element, String type, Map entryInfos); >+ >+ /** >+ * Generates properties for fetching the specified element via the fetch >+ * task. >+ * <p> >+ * The properties will be set in the fetch script before the fetch task >+ * returned by {@link #getFetchAntTask()} is executed. This allows to make >+ * the fetch task callable with different arguments. >+ * </p> >+ * >+ * @param element >+ * the element name >+ * @param type >+ * the element type (one of >+ * {@link #ELEMENT_TYPE_FEATURE <code>feature</code>}, >+ * {@link #ELEMENT_TYPE_PLUGIN <code>plugin</code>}, >+ * {@link #ELEMENT_TYPE_FRAGMENT <code>fragment</code>} or >+ * {@link #ELEMENT_TYPE_BUNDLE <code>bundle</code>}) (may not be >+ * <code>null</code>) >+ * @param entryInfos >+ * the map with detailed information collected in >+ * {@link #processMapFileEntry(String, String, String[], String, Map)}, >+ * additional keys that are set by PDE Build are: >+ * {@link #KEY_ELEMENT_NAME}, >+ * {@link #KEY_ELEMENT_TYPE} and >+ * {@link #KEY_FACTORY} >+ * @param destination >+ * the destination where the files should be fetched to >+ * @param xmlFileOnly >+ * if <code>true</code> only the element's XML descriptor >+ * should be fetched, otherwise the complete element must be >+ * fetched >+ * @return the map with properties (must be a <code>Map</code> with >+ * <code>String</code> keys and <code>String</code> values) >+ */ >+ public abstract Map generatePropertiesForFetchTask(String element, String type, Map entryInfos, String destination, boolean xmlFileOnly); >+ >+ /** >+ * Generates a task for retrieving the specified files only. >+ * <p> >+ * Note that this task is wrapped into an Ant target by the caller. >+ * The implementor is NOT allowed to create Ant targets inside the returned task. >+ * See the <a href="http://jakarta.apache.org/ant">Ant</a> >+ * website for more details on Ant scripts and Ant tasks. >+ * </p> >+ * >+ * @param element >+ * the element name >+ * @param type >+ * the element type (one of >+ * {@link #ELEMENT_TYPE_FEATURE <code>feature</code>}, >+ * {@link #ELEMENT_TYPE_PLUGIN <code>plugin</code>}, >+ * {@link #ELEMENT_TYPE_FRAGMENT <code>fragment</code>} or >+ * {@link #ELEMENT_TYPE_BUNDLE <code>bundle</code>}) (may not be >+ * <code>null</code>) >+ * @param entryInfos >+ * the map with detailed information collected in >+ * {@link #processMapFileEntry(String, String, String[], String, Map)}, >+ * additional keys that are set by PDE Build are: >+ * {@link #KEY_ELEMENT_NAME}, >+ * {@link #KEY_ELEMENT_TYPE} and >+ * {@link #KEY_FACTORY} >+ * @param destination >+ * the destination where the files should be fetched to >+ * @param files >+ * the list of files to fetch >+ * @return the task for fetching the files >+ */ >+ public abstract AntTask generateRetrieveFilesAntTask(String element, String type, Map entryInfos, String destination, String[] files); >+ >+ /** >+ * Returns a task that contains additional targets. >+ * The additional targets will be included in the fetch script. >+ * <p> >+ * Note that this task is NOT wrapped into an Ant target. The implementor >+ * is required to create Ant targets inside the returned task. >+ * See the <a href="http://jakarta.apache.org/ant">Ant</a> >+ * website for more details on Ant scripts and Ant tasks. >+ * </p> >+ * >+ * @return a task with additional targets to include in the fetch script >+ * (maybe <code>null</code> if no additional targets are necessary) >+ */ >+ public abstract AntTask getAdditionalTasks(); >+ >+ /** >+ * Returns the common task that is used to fetch elements specified via Ant >+ * properties. >+ * <p> >+ * This task is wrapped into a target, which is called from within >+ * the generated element specific fetch tasks to fetch an element. >+ * Before this task is executed properties collected in >+ * {@link #generatePropertiesForFetchTask(String, String, Map, String, boolean)} >+ * are set allowing to pass "arguments" to this task. >+ * </p> >+ * >+ * @return the common fetch task >+ * @see #generatePropertiesForFetchTask(String, String, Map, String, >+ * boolean) >+ */ >+ public abstract AntTask getFetchAntTask(); >+ >+ /** >+ * Returns a version identifyer (eg. TAG name) of the element that will be >+ * fetched. >+ * >+ * @param element >+ * the element name >+ * @param type >+ * the element type (one of >+ * {@link #ELEMENT_TYPE_FEATURE <code>feature</code>}, >+ * {@link #ELEMENT_TYPE_PLUGIN <code>plugin</code>}, >+ * {@link #ELEMENT_TYPE_FRAGMENT <code>fragment</code>} or >+ * {@link #ELEMENT_TYPE_BUNDLE <code>bundle</code>}) (may not be >+ * <code>null</code>) >+ * @param entryInfos >+ * the map with detailed information collected in >+ * {@link #processMapFileEntry(String, String, String[], String, Map)}, >+ * additional keys that are set by PDE Build are: >+ * {@link #KEY_ELEMENT_NAME}, >+ * {@link #KEY_ELEMENT_TYPE} and >+ * {@link #KEY_FACTORY} >+ * @return a version identifyer >+ */ >+ public abstract String getTagToFetch(String element, String type, Map entryInfos); >+ >+ /** >+ * Processes the specified element with the specified type. >+ * <p> >+ * The arguments specified in the map file are provided. The map with entry >+ * infos should be filled with provider specific information that is >+ * required in later processing to sucessfully generate the fetch script. >+ * </p> >+ * >+ * @param element >+ * the element name (eg. <code>com.my.plugin</code>) (may not >+ * be <code>null</code>) >+ * @param type >+ * the element type (one of >+ * {@link #ELEMENT_TYPE_FEATURE <code>feature</code>}, >+ * {@link #ELEMENT_TYPE_PLUGIN <code>plugin</code>}, >+ * {@link #ELEMENT_TYPE_FRAGMENT <code>fragment</code>} or >+ * {@link #ELEMENT_TYPE_BUNDLE <code>bundle</code>}) (may not be >+ * <code>null</code>) >+ * @param arguments >+ * the arguments specified in the build script (may not be >+ * <code>null</code>) >+ * @param fetchTag >+ * the fetch tag that will overwrite all tags specified in the >+ * repository if set (maybe <code>null</code> or empty) >+ * @param entryInfos >+ * the map to store repository specific information >+ * (eg., label/tag/authentification informationen) >+ * (may not be <code>null</code>); >+ * reserved keys that must not be used are >+ * {@link #KEY_ELEMENT_NAME}, >+ * {@link #KEY_ELEMENT_TYPE} and >+ * {@link #KEY_FACTORY} >+ * @throws CoreException >+ * if the arguments are invalid >+ */ >+ public abstract void processMapFileEntry(String element, String type, String[] arguments, String fetchTag, Map entryInfos) throws CoreException; >+} >Index: src/org/eclipse/pde/internal/build/FetchTaskFactoriesRegistry.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/build/FetchTaskFactoriesRegistry.java >diff -N src/org/eclipse/pde/internal/build/FetchTaskFactoriesRegistry.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/build/FetchTaskFactoriesRegistry.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,108 @@ >+/********************************************************************** >+ * Copyright (c) 2004, 2006 Eclipse Foundation 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Gunnar Wagenknecht - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.pde.internal.build; >+ >+import java.util.*; >+import org.eclipse.core.runtime.*; >+import org.eclipse.pde.build.FetchTaskFactory; >+ >+/** >+ * A registry for acessing fetch task factories. >+ * @since 3.2 >+ */ >+public class FetchTaskFactoriesRegistry implements IPDEBuildConstants { >+ >+ /** the shared instance */ >+ private static FetchTaskFactoriesRegistry instance; >+ >+ /** >+ * Returns the singleton registry instance. >+ * >+ * @return the registry instance >+ */ >+ public static FetchTaskFactoriesRegistry getRegistry() { >+ if (null == instance) { >+ instance = new FetchTaskFactoriesRegistry(); >+ } >+ return instance; >+ } >+ >+ /** >+ * Closes the registry, i.e. clears any caches. >+ */ >+ static void close() { >+ instance = null; >+ } >+ >+ /** a map of registered factories */ >+ private Map factories; >+ >+ /** >+ * Hidden constructor. >+ */ >+ private FetchTaskFactoriesRegistry() { >+ initializeRegistry(); >+ } >+ >+ /** >+ * Returns the factory instance with the specified id. >+ * <p> >+ * The instance is not cached. Each time this method is called, a new >+ * instance is created. >+ * </p> >+ * >+ * @param id >+ * @return the factory instance (maybe <code>null</code>) >+ */ >+ public FetchTaskFactory getFactory(String id) { >+ IConfigurationElement extension = (IConfigurationElement) factories.get(id); >+ if (null != extension) { >+ try { >+ return (FetchTaskFactory) extension.createExecutableExtension(ATTR_CLASS); >+ } catch (CoreException e) { >+ BundleHelper.getDefault().getLog().log(e.getStatus()); >+ } >+ } >+ return null; >+ } >+ >+ /** >+ * Returns a collection of registered factory ids. >+ * >+ * @return a collection of registered factory ids >+ */ >+ public Collection getFactoryIds() { >+ return factories.keySet(); >+ } >+ >+ /** >+ * Initializes the registry >+ */ >+ void initializeRegistry() { >+ >+ // don't initialize twice >+ if (null != factories) >+ return; >+ >+ synchronized (factories = new HashMap()) { >+ IConfigurationElement[] extensions = Platform.getExtensionRegistry().getConfigurationElementsFor(EXT_FETCH_TASK_FACTORIES); >+ for (int i = 0; i < extensions.length; i++) { >+ IConfigurationElement extension = extensions[i]; >+ if (ELEM_FACTORY.equals(extension.getName())) { >+ String id = extension.getAttribute(ATTR_ID); >+ if (null != id && id.trim().length() > 0) { >+ factories.put(id, extension); >+ } >+ } >+ } >+ } >+ } >+} >Index: src/org/eclipse/pde/build/ant/AntTask.java >=================================================================== >RCS file: src/org/eclipse/pde/build/ant/AntTask.java >diff -N src/org/eclipse/pde/build/ant/AntTask.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/build/ant/AntTask.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,30 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2006 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.build.ant; >+ >+ >+/** >+ * Abstract base class for Ant tasks. >+ * <p> >+ * See the <a href="http://jakarta.apache.org/ant">Ant</a> >+ * website for more details on Ant scripts and Ant tasks. >+ * </p> >+ * @since 3.2 >+ */ >+public abstract class AntTask { >+ >+ /** >+ * Print the information for this task to the given script. >+ * >+ * @param script the script to print to >+ */ >+ public abstract void print(IAntScript script); >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 34757
:
12626
|
22206
|
30757
|
33845
|
33847
|
34178
|
34179
|
34327
|
34649
|
34650
|
34651
|
34743