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.  *      https://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.      * Constructs a new instance.
  33.      */
  34.     public OpenVmsProcessingEnvironment() {
  35.         // empty
  36.     }

  37.     /*
  38.      * Hopefully removing super-class overrides won't cause Clirr error. If necessary can just delegate to super-class.
  39.      */

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