001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   https://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019
020package org.apache.commons.exec.environment;
021
022//import java.io.BufferedReader;
023//import java.io.IOException;
024//import java.util.HashMap;
025//import java.util.Map;
026//
027//import org.apache.commons.exec.CommandLine;
028
029/**
030 * Helper class to determine the environment variable for VMS.
031 *
032 * @deprecated No longer needed.
033 */
034@Deprecated
035public class OpenVmsProcessingEnvironment extends DefaultProcessingEnvironment {
036
037    /**
038     * Constructs a new instance.
039     */
040    public OpenVmsProcessingEnvironment() {
041        // empty
042    }
043
044    /*
045     * Hopefully removing super-class overrides won't cause Clirr error. If necessary can just delegate to super-class.
046     */
047
048//    /**
049//     * Find the list of environment variables for this process.
050//     *
051//     * @return a map containing the environment variables
052//     * @throws IOException the operation failed
053//     */
054//    @Override
055//    protected Map<String, String> createProcEnvironment() throws IOException {
056//        if (procEnvironment == null) {
057//            final BufferedReader in = runProcEnvCommand();
058//            procEnvironment = addVMSenvironmentVariables(new HashMap<String, String>(), in);
059//        }
060//
061//        return procEnvironment;
062//    }
063//
064//    /**
065//     * Determine the OS specific command line to get a list of environment
066//     * variables.
067//     *
068//     * @return the command line
069//     */
070//    @Override
071//    protected CommandLine getProcEnvCommand() {
072//        final CommandLine commandLine = new CommandLine("show");
073//        commandLine.addArgument("symbol/global"); // the parser assumes symbols are global
074//        commandLine.addArgument("*");
075//        return commandLine;
076//    }
077//
078//    /**
079//     * This method is VMS specific and used by getProcEnvironment(). Parses VMS
080//     * symbols from {@code in} and adds them to {@code environment}.
081//     * {@code in} is expected to be the output of "SHOW SYMBOL/GLOBAL *".
082//     *
083//     * @param environment the current environment
084//     * @param in the reader from the process to determine VMS env variables
085//     * @return the updated environment
086//     * @throws IOException operation failed
087//     */
088//    private Map<String, String> addVMSenvironmentVariables(final Map<String, String> environment,
089//            final BufferedReader in) throws IOException {
090//        String line;
091//        while ((line = in.readLine()) != null) {
092//            final String SEP = "=="; // global symbol separator
093//            final int sepidx = line.indexOf(SEP);
094//            if (sepidx > 0) {
095//                final String name = line.substring(0, sepidx).trim();
096//                String value = line.substring(sepidx+SEP.length()).trim();
097//                value = value.substring(1,value.length()-1); // drop enclosing quotes
098//                environment.put(name,value);
099//            }
100//        }
101//        return environment;
102//    }
103}