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