1 | /*
|
---|
2 | * Copyright 2001-2002,2004 The Apache Software Foundation
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | *
|
---|
16 | */
|
---|
17 |
|
---|
18 | package org.apache.tools.ant.taskdefs.optional.ide;
|
---|
19 |
|
---|
20 |
|
---|
21 | import java.io.File;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * A Remote Access to Tools Servlet to extract package
|
---|
25 | * sets from the Workbench to the local file system.
|
---|
26 | * The following table describes the servlet parameters.
|
---|
27 | *
|
---|
28 | * <table border="1">
|
---|
29 | * <tr>
|
---|
30 | * <td><strong>Parameter</strong></td>
|
---|
31 | * <td><strong>Values</strong></td>
|
---|
32 | * <td><strong>Description</strong></td>
|
---|
33 | * </tr>
|
---|
34 | * <tr>
|
---|
35 | * <td>dir</td>
|
---|
36 | * <td>Any valid directory name on the server.</td>
|
---|
37 | * <td>The directory to export the files to on the machine
|
---|
38 | * where the servlet is being run. If the directory
|
---|
39 | * doesn't exist, it will be created.<p>
|
---|
40 | * Relative paths are relative to
|
---|
41 | * IBMVJava/ide/tools/com-ibm-ivj-toolserver,
|
---|
42 | * where IBMVJava is the VisualAge for Java installation
|
---|
43 | * directory.</td>
|
---|
44 | * </tr>
|
---|
45 | * <tr>
|
---|
46 | * <td>include</td>
|
---|
47 | * <td>See below.</td>
|
---|
48 | * <td>The pattern used to indicate which projects and
|
---|
49 | * packages to export.</td>
|
---|
50 | * </tr>
|
---|
51 | * <tr>
|
---|
52 | * <td>exclude</td>
|
---|
53 | * <td>See below</td>
|
---|
54 | * <td>The pattern used to indicate which projects and
|
---|
55 | * packages <em>not</em> to export.</td>
|
---|
56 | * </tr>
|
---|
57 | * <tr>
|
---|
58 | * <td>cls</td>
|
---|
59 | * <td>"yes" or "no" (without the quotes)</td>
|
---|
60 | * <td>Export class files. Defaults to "no".</td>
|
---|
61 | * </tr>
|
---|
62 | * <tr>
|
---|
63 | * <td>src</td>
|
---|
64 | * <td>"yes" or "no" (without the quotes)</td>
|
---|
65 | * <td>Export source files. Defaults to "yes".</td>
|
---|
66 | * </tr>
|
---|
67 | * <tr>
|
---|
68 | * <td>res</td>
|
---|
69 | * <td>"yes" or "no" (without the quotes)</td>
|
---|
70 | * <td>Export resource files associated with the included project(s).
|
---|
71 | * Defaults to "yes".</td>
|
---|
72 | * </tr>
|
---|
73 | * <tr>
|
---|
74 | * <td>dex</td>
|
---|
75 | * <td>"yes" or "no" (without the quotes)</td>
|
---|
76 | * <td>Use the default exclusion patterns. Defaults to "yes".
|
---|
77 | * See below for an explanation of default excludes.</td>
|
---|
78 | * </tr>
|
---|
79 | * <tr>
|
---|
80 | * <td>owr</td>
|
---|
81 | * <td>"yes" or "no" (without the quotes)</td>
|
---|
82 | * <td>Overwrite any existing files. Defaults to "yes".</td>
|
---|
83 | * </tr>
|
---|
84 | * </table>
|
---|
85 | *
|
---|
86 | * <p>The vajexport servlet uses include and exclude parameters to form
|
---|
87 | * the criteria for selecting packages to export. The parameter is
|
---|
88 | * broken up into ProjectName/packageNameSegments, where ProjectName
|
---|
89 | * is what you expect, and packageNameSegments is a partial (or complete)
|
---|
90 | * package name, separated by forward slashes, rather than periods.
|
---|
91 | * Each packageNameSegment can have wildcard characters.</p>
|
---|
92 | *
|
---|
93 | * <table border="1">
|
---|
94 | * <tr>
|
---|
95 | * <td><strong>Wildcard Characters</strong></td>
|
---|
96 | * <td><strong>Description</strong></td>
|
---|
97 | * </tr>
|
---|
98 | * <tr>
|
---|
99 | * <td>*</td>
|
---|
100 | * <td>Match zero or more characters in that segment.</td>
|
---|
101 | * </tr>
|
---|
102 | * <tr>
|
---|
103 | * <td>?</td>
|
---|
104 | * <td>Match one character in that segment.</td>
|
---|
105 | * </tr>
|
---|
106 | * <tr>
|
---|
107 | * <td>**</td>
|
---|
108 | * <td>Matches all characters in zero or more segments.</td>
|
---|
109 | * </tr>
|
---|
110 | * </table>
|
---|
111 | *
|
---|
112 | */
|
---|
113 | public class VAJExportServlet extends VAJToolsServlet {
|
---|
114 | // constants for servlet param names
|
---|
115 | public static final String WITH_DEBUG_INFO = "deb";
|
---|
116 | public static final String OVERWRITE_PARAM = "owr";
|
---|
117 |
|
---|
118 | /**
|
---|
119 | * Respond to a request to export packages from the Workbench.
|
---|
120 | */
|
---|
121 | protected void executeRequest() {
|
---|
122 | getUtil().exportPackages(
|
---|
123 | new File(getFirstParamValueString(DIR_PARAM)),
|
---|
124 | getParamValues(INCLUDE_PARAM),
|
---|
125 | getParamValues(EXCLUDE_PARAM),
|
---|
126 | getBooleanParam(CLASSES_PARAM, false),
|
---|
127 | getBooleanParam(WITH_DEBUG_INFO, false),
|
---|
128 | getBooleanParam(RESOURCES_PARAM, true),
|
---|
129 | getBooleanParam(SOURCES_PARAM, true),
|
---|
130 | getBooleanParam(DEFAULT_EXCLUDES_PARAM, true),
|
---|
131 | getBooleanParam(OVERWRITE_PARAM, true));
|
---|
132 | }
|
---|
133 | }
|
---|