01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM - Initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.build.tasks;
11:
12: import org.apache.tools.ant.BuildException;
13: import org.apache.tools.ant.Task;
14: import org.eclipse.core.runtime.CoreException;
15: import org.eclipse.pde.internal.build.AbstractScriptGenerator;
16: import org.eclipse.pde.internal.build.BundleHelper;
17: import org.eclipse.pde.internal.build.packager.FetchFileGenerator;
18:
19: /**
20: * Internal Task.
21: * Generate fetch script to get files from a URL based on a packager map.
22: * @since 3.0
23: */
24: public class FetchFileGeneratorTask extends Task {
25: protected FetchFileGenerator fileFetcher = new FetchFileGenerator();
26:
27: /**
28: * Set the folder in which the scripts will be generated.
29: * @param workingDirectory the location where the scripts will be generated.
30: */
31: public void setWorkingDirectory(String workingDirectory) {
32: fileFetcher.setWorkingDirectory(workingDirectory);
33: }
34:
35: /**
36: * Set the configuration for which the script should be generated. The default is set to be configuration independent.
37: * @param config an ampersand separated list of configuration (for example win32, win32, x86 & macoxs, carbon, ppc).
38: * @throws CoreException
39: */
40: public void setConfigInfo(String config) throws CoreException {
41: AbstractScriptGenerator.setConfigInfo(config);
42: }
43:
44: /**
45: * Set the filters used to select the content type of the components to be downloaded. The values are matched against values from the map.
46: * @param filter a comma separated list of content.
47: */
48: public void setContentFilter(String filter) {
49: fileFetcher.setContentFilter(filter);
50: }
51:
52: /**
53: * Set the filters used to select the components to be downloaded. The values are matched against values from the map.
54: * @param components a comma separated list of components.
55: */
56: public void setComponentFilter(String components) {
57: fileFetcher.setComponentFilter(components);
58: }
59:
60: /**
61: * Set the path the a packager map file.
62: * @param mapLocation path the a packager map file.
63: */
64: public void setMap(String mapLocation) {
65: fileFetcher.setMapLocation(mapLocation);
66: }
67:
68: public void execute() throws BuildException {
69: try {
70: BundleHelper.getDefault().setLog(this );
71: fileFetcher.generate();
72: BundleHelper.getDefault().setLog(null);
73: } catch (CoreException e) {
74: throw new BuildException(TaskHelper.statusToString(
75: e.getStatus(), null).toString());
76: }
77: }
78: }
|