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.io.File;
  19. /**
  20. * A Remote Access to Tools Servlet to extract package
  21. * sets from the Workbench to the local file system.
  22. * The following table describes the servlet parameters.
  23. *
  24. * <table border="1">
  25. * <tr>
  26. * <td><strong>Parameter</strong></td>
  27. * <td><strong>Values</strong></td>
  28. * <td><strong>Description</strong></td>
  29. * </tr>
  30. * <tr>
  31. * <td>dir</td>
  32. * <td>Any valid directory name on the server.</td>
  33. * <td>The directory to export the files to on the machine
  34. * where the servlet is being run. If the directory
  35. * doesn't exist, it will be created.<p>
  36. * Relative paths are relative to
  37. * IBMVJava/ide/tools/com-ibm-ivj-toolserver,
  38. * where IBMVJava is the VisualAge for Java installation
  39. * directory.</td>
  40. * </tr>
  41. * <tr>
  42. * <td>include</td>
  43. * <td>See below.</td>
  44. * <td>The pattern used to indicate which projects and
  45. * packages to export.</td>
  46. * </tr>
  47. * <tr>
  48. * <td>exclude</td>
  49. * <td>See below</td>
  50. * <td>The pattern used to indicate which projects and
  51. * packages <em>not</em> to export.</td>
  52. * </tr>
  53. * <tr>
  54. * <td>cls</td>
  55. * <td>"yes" or "no" (without the quotes)</td>
  56. * <td>Export class files. Defaults to "no".</td>
  57. * </tr>
  58. * <tr>
  59. * <td>src</td>
  60. * <td>"yes" or "no" (without the quotes)</td>
  61. * <td>Export source files. Defaults to "yes".</td>
  62. * </tr>
  63. * <tr>
  64. * <td>res</td>
  65. * <td>"yes" or "no" (without the quotes)</td>
  66. * <td>Export resource files associated with the included project(s).
  67. * Defaults to "yes".</td>
  68. * </tr>
  69. * <tr>
  70. * <td>dex</td>
  71. * <td>"yes" or "no" (without the quotes)</td>
  72. * <td>Use the default exclusion patterns. Defaults to "yes".
  73. * See below for an explanation of default excludes.</td>
  74. * </tr>
  75. * <tr>
  76. * <td>owr</td>
  77. * <td>"yes" or "no" (without the quotes)</td>
  78. * <td>Overwrite any existing files. Defaults to "yes".</td>
  79. * </tr>
  80. * </table>
  81. *
  82. * <p>The vajexport servlet uses include and exclude parameters to form
  83. * the criteria for selecting packages to export. The parameter is
  84. * broken up into ProjectName/packageNameSegments, where ProjectName
  85. * is what you expect, and packageNameSegments is a partial (or complete)
  86. * package name, separated by forward slashes, rather than periods.
  87. * Each packageNameSegment can have wildcard characters.</p>
  88. *
  89. * <table border="1">
  90. * <tr>
  91. * <td><strong>Wildcard Characters</strong></td>
  92. * <td><strong>Description</strong></td>
  93. * </tr>
  94. * <tr>
  95. * <td>*</td>
  96. * <td>Match zero or more characters in that segment.</td>
  97. * </tr>
  98. * <tr>
  99. * <td>?</td>
  100. * <td>Match one character in that segment.</td>
  101. * </tr>
  102. * <tr>
  103. * <td>**</td>
  104. * <td>Matches all characters in zero or more segments.</td>
  105. * </tr>
  106. * </table>
  107. *
  108. */
  109. public class VAJExportServlet extends VAJToolsServlet {
  110. // constants for servlet param names
  111. public static final String WITH_DEBUG_INFO = "deb";
  112. public static final String OVERWRITE_PARAM = "owr";
  113. /**
  114. * Respond to a request to export packages from the Workbench.
  115. */
  116. protected void executeRequest() {
  117. getUtil().exportPackages(
  118. new File(getFirstParamValueString(DIR_PARAM)),
  119. getParamValues(INCLUDE_PARAM),
  120. getParamValues(EXCLUDE_PARAM),
  121. getBooleanParam(CLASSES_PARAM, false),
  122. getBooleanParam(WITH_DEBUG_INFO, false),
  123. getBooleanParam(RESOURCES_PARAM, true),
  124. getBooleanParam(SOURCES_PARAM, true),
  125. getBooleanParam(DEFAULT_EXCLUDES_PARAM, true),
  126. getBooleanParam(OVERWRITE_PARAM, true));
  127. }
  128. }