View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   https://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.commons.exec.environment;
21  
22  //import java.io.BufferedReader;
23  //import java.io.IOException;
24  //import java.util.HashMap;
25  //import java.util.Map;
26  //
27  //import org.apache.commons.exec.CommandLine;
28  
29  /**
30   * Helper class to determine the environment variable for VMS.
31   *
32   * @deprecated No longer needed.
33   */
34  @Deprecated
35  public class OpenVmsProcessingEnvironment extends DefaultProcessingEnvironment {
36  
37      /**
38       * Constructs a new instance.
39       */
40      public OpenVmsProcessingEnvironment() {
41          // empty
42      }
43  
44      /*
45       * Hopefully removing super-class overrides won't cause Clirr error. If necessary can just delegate to super-class.
46       */
47  
48  //    /**
49  //     * Find the list of environment variables for this process.
50  //     *
51  //     * @return a map containing the environment variables
52  //     * @throws IOException the operation failed
53  //     */
54  //    @Override
55  //    protected Map<String, String> createProcEnvironment() throws IOException {
56  //        if (procEnvironment == null) {
57  //            final BufferedReader in = runProcEnvCommand();
58  //            procEnvironment = addVMSenvironmentVariables(new HashMap<String, String>(), in);
59  //        }
60  //
61  //        return procEnvironment;
62  //    }
63  //
64  //    /**
65  //     * Determine the OS specific command line to get a list of environment
66  //     * variables.
67  //     *
68  //     * @return the command line
69  //     */
70  //    @Override
71  //    protected CommandLine getProcEnvCommand() {
72  //        final CommandLine commandLine = new CommandLine("show");
73  //        commandLine.addArgument("symbol/global"); // the parser assumes symbols are global
74  //        commandLine.addArgument("*");
75  //        return commandLine;
76  //    }
77  //
78  //    /**
79  //     * This method is VMS specific and used by getProcEnvironment(). Parses VMS
80  //     * symbols from {@code in} and adds them to {@code environment}.
81  //     * {@code in} is expected to be the output of "SHOW SYMBOL/GLOBAL *".
82  //     *
83  //     * @param environment the current environment
84  //     * @param in the reader from the process to determine VMS env variables
85  //     * @return the updated environment
86  //     * @throws IOException operation failed
87  //     */
88  //    private Map<String, String> addVMSenvironmentVariables(final Map<String, String> environment,
89  //            final BufferedReader in) throws IOException {
90  //        String line;
91  //        while ((line = in.readLine()) != null) {
92  //            final String SEP = "=="; // global symbol separator
93  //            final int sepidx = line.indexOf(SEP);
94  //            if (sepidx > 0) {
95  //                final String name = line.substring(0, sepidx).trim();
96  //                String value = line.substring(sepidx+SEP.length()).trim();
97  //                value = value.substring(1,value.length()-1); // drop enclosing quotes
98  //                environment.put(name,value);
99  //            }
100 //        }
101 //        return environment;
102 //    }
103 }