OpenVmsProcessingEnvironment.java

  1. /*
  2.  * Licensed to the Apache Software Foundation (ASF) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * The ASF licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *      http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */

  17. package org.apache.commons.exec.environment;

  18. //import java.io.BufferedReader;
  19. //import java.io.IOException;
  20. //import java.util.HashMap;
  21. //import java.util.Map;
  22. //
  23. //import org.apache.commons.exec.CommandLine;

  24. /**
  25.  * Helper class to determine the environment variable for VMS.
  26.  *
  27.  * @deprecated No longer needed.
  28.  */
  29. @Deprecated
  30. public class OpenVmsProcessingEnvironment extends DefaultProcessingEnvironment {

  31.     /*
  32.      * Hopefully removing super-class overrides won't cause Clirr error. If necessary can just delegate to super-class.
  33.      */

  34. //    /**
  35. //     * Find the list of environment variables for this process.
  36. //     *
  37. //     * @return a map containing the environment variables
  38. //     * @throws IOException the operation failed
  39. //     */
  40. //    @Override
  41. //    protected Map<String, String> createProcEnvironment() throws IOException {
  42. //        if (procEnvironment == null) {
  43. //            final BufferedReader in = runProcEnvCommand();
  44. //            procEnvironment = addVMSenvironmentVariables(new HashMap<String, String>(), in);
  45. //        }
  46. //
  47. //        return procEnvironment;
  48. //    }
  49. //
  50. //    /**
  51. //     * Determine the OS specific command line to get a list of environment
  52. //     * variables.
  53. //     *
  54. //     * @return the command line
  55. //     */
  56. //    @Override
  57. //    protected CommandLine getProcEnvCommand() {
  58. //        final CommandLine commandLine = new CommandLine("show");
  59. //        commandLine.addArgument("symbol/global"); // the parser assumes symbols are global
  60. //        commandLine.addArgument("*");
  61. //        return commandLine;
  62. //    }
  63. //
  64. //    /**
  65. //     * This method is VMS specific and used by getProcEnvironment(). Parses VMS
  66. //     * symbols from {@code in} and adds them to {@code environment}.
  67. //     * {@code in} is expected to be the output of "SHOW SYMBOL/GLOBAL *".
  68. //     *
  69. //     * @param environment the current environment
  70. //     * @param in the reader from the process to determine VMS env variables
  71. //     * @return the updated environment
  72. //     * @throws IOException operation failed
  73. //     */
  74. //    private Map<String, String> addVMSenvironmentVariables(final Map<String, String> environment,
  75. //            final BufferedReader in) throws IOException {
  76. //        String line;
  77. //        while ((line = in.readLine()) != null) {
  78. //            final String SEP = "=="; // global symbol separator
  79. //            final int sepidx = line.indexOf(SEP);
  80. //            if (sepidx > 0) {
  81. //                final String name = line.substring(0, sepidx).trim();
  82. //                String value = line.substring(sepidx+SEP.length()).trim();
  83. //                value = value.substring(1,value.length()-1); // drop enclosing quotes
  84. //                environment.put(name,value);
  85. //            }
  86. //        }
  87. //        return environment;
  88. //    }
  89. }