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