View Javadoc
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  
18  package org.apache.commons.exec.environment;
19  
20  //import java.io.BufferedReader;
21  //import java.io.IOException;
22  //import java.util.HashMap;
23  //import java.util.Map;
24  //
25  //import org.apache.commons.exec.CommandLine;
26  
27  /**
28   * Helper class to determine the environment variable for VMS.
29   *
30   * @deprecated No longer needed.
31   */
32  @Deprecated
33  public class OpenVmsProcessingEnvironment extends DefaultProcessingEnvironment {
34  
35      /**
36       * Constructs a new instance.
37       */
38      public OpenVmsProcessingEnvironment() {
39          // empty
40      }
41  
42      /*
43       * Hopefully removing super-class overrides won't cause Clirr error. If necessary can just delegate to super-class.
44       */
45  
46  //    /**
47  //     * Find the list of environment variables for this process.
48  //     *
49  //     * @return a map containing the environment variables
50  //     * @throws IOException the operation failed
51  //     */
52  //    @Override
53  //    protected Map<String, String> createProcEnvironment() throws IOException {
54  //        if (procEnvironment == null) {
55  //            final BufferedReader in = runProcEnvCommand();
56  //            procEnvironment = addVMSenvironmentVariables(new HashMap<String, String>(), in);
57  //        }
58  //
59  //        return procEnvironment;
60  //    }
61  //
62  //    /**
63  //     * Determine the OS specific command line to get a list of environment
64  //     * variables.
65  //     *
66  //     * @return the command line
67  //     */
68  //    @Override
69  //    protected CommandLine getProcEnvCommand() {
70  //        final CommandLine commandLine = new CommandLine("show");
71  //        commandLine.addArgument("symbol/global"); // the parser assumes symbols are global
72  //        commandLine.addArgument("*");
73  //        return commandLine;
74  //    }
75  //
76  //    /**
77  //     * This method is VMS specific and used by getProcEnvironment(). Parses VMS
78  //     * symbols from {@code in} and adds them to {@code environment}.
79  //     * {@code in} is expected to be the output of "SHOW SYMBOL/GLOBAL *".
80  //     *
81  //     * @param environment the current environment
82  //     * @param in the reader from the process to determine VMS env variables
83  //     * @return the updated environment
84  //     * @throws IOException operation failed
85  //     */
86  //    private Map<String, String> addVMSenvironmentVariables(final Map<String, String> environment,
87  //            final BufferedReader in) throws IOException {
88  //        String line;
89  //        while ((line = in.readLine()) != null) {
90  //            final String SEP = "=="; // global symbol separator
91  //            final int sepidx = line.indexOf(SEP);
92  //            if (sepidx > 0) {
93  //                final String name = line.substring(0, sepidx).trim();
94  //                String value = line.substring(sepidx+SEP.length()).trim();
95  //                value = value.substring(1,value.length()-1); // drop enclosing quotes
96  //                environment.put(name,value);
97  //            }
98  //        }
99  //        return environment;
100 //    }
101 }