001    /*
002     * CDDL HEADER START
003     *
004     * The contents of this file are subject to the terms of the
005     * Common Development and Distribution License, Version 1.0 only
006     * (the "License").  You may not use this file except in compliance
007     * with the License.
008     *
009     * You can obtain a copy of the license at
010     * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011     * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2008 Sun Microsystems, Inc.
026     */
027    package org.opends.server.util.cli;
028    
029    
030    
031    /**
032     * A console application decorator which redirects all output to the
033     * underlying application's output stream.
034     */
035    public class OutputStreamConsoleApplication extends ConsoleApplication {
036    
037      // The underlying console application.
038      private final ConsoleApplication app;
039    
040    
041    
042      /**
043       * Creates a new console application instance which redirects all
044       * output to the underlying application's output stream.
045       *
046       * @param app
047       *          The underlying application console.
048       */
049      public OutputStreamConsoleApplication(ConsoleApplication app) {
050        super(app.getInputStream(), app.getOutputStream(), app.getOutputStream());
051    
052        this.app = app;
053      }
054    
055    
056    
057      /**
058       * {@inheritDoc}
059       */
060      @Override
061      public boolean isAdvancedMode() {
062        return app.isAdvancedMode();
063      }
064    
065    
066    
067      /**
068       * {@inheritDoc}
069       */
070      @Override
071      public boolean isInteractive() {
072        return app.isInteractive();
073      }
074    
075    
076    
077      /**
078       * {@inheritDoc}
079       */
080      @Override
081      public boolean isMenuDrivenMode() {
082        return app.isMenuDrivenMode();
083      }
084    
085    
086    
087      /**
088       * {@inheritDoc}
089       */
090      @Override
091      public boolean isQuiet() {
092        return app.isQuiet();
093      }
094    
095    
096    
097      /**
098       * {@inheritDoc}
099       */
100      @Override
101      public boolean isScriptFriendly() {
102        return app.isScriptFriendly();
103      }
104    
105    
106    
107      /**
108       * {@inheritDoc}
109       */
110      @Override
111      public boolean isVerbose() {
112        return app.isVerbose();
113      }
114    
115    }