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 | import java.util.Vector;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * A Remote Access to Tools Servlet to load a Project
|
---|
24 | * from the Repository into the Workbench. The following
|
---|
25 | * table describes the servlet parameters.
|
---|
26 | *
|
---|
27 | * <table>
|
---|
28 | * <tr>
|
---|
29 | * <td>Parameter</td>
|
---|
30 | * <td>Description</td>
|
---|
31 | * </tr>
|
---|
32 | * <tr>
|
---|
33 | * <td>project</td>
|
---|
34 | * <td>The name of the Project you want to load into
|
---|
35 | * the Workbench.</td>
|
---|
36 | * </tr>
|
---|
37 | * <tr>
|
---|
38 | * <td>version</td>
|
---|
39 | * <td>The version of the package you want to load into
|
---|
40 | * the Workbench.</td>
|
---|
41 | * </tr>
|
---|
42 | * </table>
|
---|
43 | *
|
---|
44 | */
|
---|
45 | public class VAJLoadServlet extends VAJToolsServlet {
|
---|
46 |
|
---|
47 | // constants for servlet param names
|
---|
48 | /**
|
---|
49 | * the version param string
|
---|
50 | */
|
---|
51 | public static final String VERSION_PARAM = "version";
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * Respond to a request to load a project from the Repository
|
---|
55 | * into the Workbench.
|
---|
56 | */
|
---|
57 | protected void executeRequest() {
|
---|
58 | String[] projectNames = getParamValues(PROJECT_NAME_PARAM);
|
---|
59 | String[] versionNames = getParamValues(VERSION_PARAM);
|
---|
60 |
|
---|
61 | Vector projectDescriptions = new Vector(projectNames.length);
|
---|
62 | for (int i = 0; i < projectNames.length && i < versionNames.length; i++) {
|
---|
63 | VAJProjectDescription desc = new VAJProjectDescription();
|
---|
64 | desc.setName(projectNames[i]);
|
---|
65 | desc.setVersion(versionNames[i]);
|
---|
66 | projectDescriptions.addElement(desc);
|
---|
67 | }
|
---|
68 |
|
---|
69 | util.loadProjects(projectDescriptions);
|
---|
70 | }
|
---|
71 | }
|
---|