KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > build > tasks > FetchFileGeneratorTask


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM - Initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.build.tasks;
12
13 import org.apache.tools.ant.BuildException;
14 import org.apache.tools.ant.Task;
15 import org.eclipse.core.runtime.CoreException;
16 import org.eclipse.pde.internal.build.AbstractScriptGenerator;
17 import org.eclipse.pde.internal.build.BundleHelper;
18 import org.eclipse.pde.internal.build.packager.FetchFileGenerator;
19
20 /**
21  * Internal Task.
22  * Generate fetch script to get files from a URL based on a packager map.
23  * @since 3.0
24  */

25 public class FetchFileGeneratorTask extends Task {
26     protected FetchFileGenerator fileFetcher = new FetchFileGenerator();
27
28
29     /**
30      * Set the folder in which the scripts will be generated.
31      * @param workingDirectory the location where the scripts will be generated.
32      */

33     public void setWorkingDirectory(String JavaDoc workingDirectory) {
34         fileFetcher.setWorkingDirectory(workingDirectory);
35     }
36     
37     /**
38      * Set the configuration for which the script should be generated. The default is set to be configuration independent.
39      * @param config an ampersand separated list of configuration (for example win32, win32, x86 & macoxs, carbon, ppc).
40      * @throws CoreException
41      */

42     public void setConfigInfo(String JavaDoc config) throws CoreException {
43         AbstractScriptGenerator.setConfigInfo(config);
44     }
45
46     /**
47      * Set the filters used to select the content type of the components to be downloaded. The values are matched against values from the map.
48      * @param filter a comma separated list of content.
49      */

50     public void setContentFilter(String JavaDoc filter) {
51         fileFetcher.setContentFilter(filter);
52     }
53
54     /**
55      * Set the filters used to select the components to be downloaded. The values are matched against values from the map.
56      * @param components a comma separated list of components.
57      */

58     public void setComponentFilter(String JavaDoc components) {
59         fileFetcher.setComponentFilter(components);
60     }
61
62     /**
63      * Set the path the a packager map file.
64      * @param mapLocation path the a packager map file.
65      */

66     public void setMap(String JavaDoc mapLocation) {
67         fileFetcher.setMapLocation(mapLocation);
68     }
69
70     public void execute() throws BuildException {
71         try {
72             BundleHelper.getDefault().setLog(this);
73             fileFetcher.generate();
74             BundleHelper.getDefault().setLog(null);
75         } catch (CoreException e) {
76             throw new BuildException(TaskHelper.statusToString(e.getStatus(), null).toString());
77         }
78     }
79 }
80
Popular Tags