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