KickJava   Java API By Example, From Geeks To Geeks.

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


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.*;
17 import org.eclipse.pde.internal.build.site.BuildTimeSiteFactory;
18
19 /**
20  * Generate fetch scripts for the given elements. This is the implementation of the "eclipse.fetch" Ant task.
21  */

22 public class FetchTask extends Task {
23
24     /**
25      * The application associated with this Ant task.
26      */

27     protected FetchScriptGenerator generator;
28
29     /**
30      * Default constructor this class.
31      */

32     public FetchTask() {
33         generator = new FetchScriptGenerator();
34     }
35
36     /**
37      * Set the boolean value indicating whether or not the fetch scripts should be
38      * generated for the children of the elements. The default is set to <code>true</code>
39      *
40      * @param children <code>true</code> if the children scripts should be generated
41      * and <code>false</code> otherwise
42      * @since 3.0
43      */

44     public void setChildren(boolean children) {
45         generator.setFetchChildren(children);
46     }
47
48     /**
49      * Set the location for the CVS password file.
50      * @param cvsPassFileLocation the location of the password file
51      */

52     public void setCvsPassFile(String JavaDoc cvsPassFileLocation) {
53         generator.setCvsPassFileLocation(cvsPassFileLocation);
54     }
55
56     /**
57      * The path to a directory file.
58      * @param directoryLocation the location of a directory file
59      */

60     public void setDirectory(String JavaDoc directoryLocation) {
61         generator.setDirectoryLocation(directoryLocation);
62     }
63
64     /**
65      * @param element
66      */

67     public void setElements(String JavaDoc element) {
68         generator.setElement(element);
69     }
70
71     /**
72      * Overrides the tags provided in directory file by the given value.
73      * @param value the tag to be fetched.
74      * @since 3.0
75      */

76     public void setFetchTag(String JavaDoc value) {
77         generator.setFetchTagAsString(value);
78     }
79
80     /**
81      * Set the folder in which the scripts will be generated, and in which the plugins and features will be fetched.
82      * @param buildDirectory the location where the scripts will be generated and the files fetched.
83      * @since 3.0
84      */

85     public void setBuildDirectory(String JavaDoc buildDirectory) {
86         generator.setWorkingDirectory(buildDirectory);
87     }
88
89     /**
90      * Set the folder in which the scripts will be generated, and in which the plugins and features will be fetched.
91      * @param installLocation the location where the scripts will be generated and the files fetched.
92      * @deprecated see {@link #setBuildDirectory(String)}
93      */

94     public void setInstall(String JavaDoc installLocation) {
95         generator.setWorkingDirectory(installLocation);
96     }
97
98     public void execute() throws BuildException {
99         try {
100             BundleHelper.getDefault().setLog(this);
101             generator.generate();
102             BundleHelper.getDefault().setLog(null);
103         } catch (CoreException e) {
104             throw new BuildException(TaskHelper.statusToString(e.getStatus(), null).toString());
105         }
106     }
107
108     /**
109      * Set the boolean value indicating whether or not the fetch scripts should be
110      * generated for nested features. The default is set to true.
111      * @param recursiveGeneration <code>true</code> if the scripts for the nested features should be generated
112      * and <code>false</code> otherwise.
113      * @since 3.0
114      */

115     public void setRecursiveGeneration(boolean recursiveGeneration) {
116         generator.setRecursiveGeneration(recursiveGeneration);
117     }
118
119     /**
120      * Set the configuration for which the script should be generated. The default is set to be configuration independent.
121      * @param configInfo an ampersand separated list of configuration (for example win32, win32, x86 & macoxs, carbon, ppc).
122      * @throws CoreException
123      * @since 3.0
124      */

125     public void setConfigInfo(String JavaDoc configInfo) throws CoreException {
126         AbstractScriptGenerator.setConfigInfo(configInfo);
127     }
128
129     /**
130      * Set a location that contains plugins and features required by plugins and features for which build scripts are being generated.
131      * @param baseLocation a path to a folder
132      * @since 3.1
133      */

134     public void setBaseLocation(String JavaDoc baseLocation) {
135         BuildTimeSiteFactory.setInstalledBaseSite(baseLocation);
136     }
137 }
138
Popular Tags