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 *      http://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     * Hopefully removing super-class overrides won't cause Clirr error. If necessary can just delegate to super-class.
037     */
038
039//    /**
040//     * Find the list of environment variables for this process.
041//     *
042//     * @return a map containing the environment variables
043//     * @throws IOException the operation failed
044//     */
045//    @Override
046//    protected Map<String, String> createProcEnvironment() throws IOException {
047//        if (procEnvironment == null) {
048//            final BufferedReader in = runProcEnvCommand();
049//            procEnvironment = addVMSenvironmentVariables(new HashMap<String, String>(), in);
050//        }
051//
052//        return procEnvironment;
053//    }
054//
055//    /**
056//     * Determine the OS specific command line to get a list of environment
057//     * variables.
058//     *
059//     * @return the command line
060//     */
061//    @Override
062//    protected CommandLine getProcEnvCommand() {
063//        final CommandLine commandLine = new CommandLine("show");
064//        commandLine.addArgument("symbol/global"); // the parser assumes symbols are global
065//        commandLine.addArgument("*");
066//        return commandLine;
067//    }
068//
069//    /**
070//     * This method is VMS specific and used by getProcEnvironment(). Parses VMS
071//     * symbols from {@code in} and adds them to {@code environment}.
072//     * {@code in} is expected to be the output of "SHOW SYMBOL/GLOBAL *".
073//     *
074//     * @param environment the current environment
075//     * @param in the reader from the process to determine VMS env variables
076//     * @return the updated environment
077//     * @throws IOException operation failed
078//     */
079//    private Map<String, String> addVMSenvironmentVariables(final Map<String, String> environment,
080//            final BufferedReader in) throws IOException {
081//        String line;
082//        while ((line = in.readLine()) != null) {
083//            final String SEP = "=="; // global symbol separator
084//            final int sepidx = line.indexOf(SEP);
085//            if (sepidx > 0) {
086//                final String name = line.substring(0, sepidx).trim();
087//                String value = line.substring(sepidx+SEP.length()).trim();
088//                value = value.substring(1,value.length()-1); // drop enclosing quotes
089//                environment.put(name,value);
090//            }
091//        }
092//        return environment;
093//    }
094}