DBVIEW
src/org/dbview/runtime/cli/CliData.java
00001 /*
00002         DbView - Graph Visualization
00003     Copyright (C) 2012  Denis BEURIVE
00004 
00005     This program is free software: you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation, either version 3 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 /**
00020  * @author Denis Beurive
00021  */
00022 
00023 package org.dbview.runtime.cli;
00024 import java.util.Hashtable;
00025 
00026 /**
00027  * <p>This class contains the data extracted from the command line.</p>
00028  * <p>The interpretation of this data structure depends on the type of request.</p>
00029  * @author Denis Beurive
00030  */
00031 public class CliData
00032 {
00033     /**
00034      * This attribute represents the type of request.
00035      * @remark See class CliParser.
00036      *         Request types are represented by constants. The constants' names begin with the string "CS_" (Command Selector).
00037      */
00038         public int type = org.dbview.runtime.cli.CliActionSelector.CLI_UNKNOWN;
00039 
00040         /**
00041          * This attribute contains the data extracted from the command line.
00042          * The attribute's value can be "null" if the request does not require data.
00043          * <ul>
00044          *     <li>Key: The name of a command line option.</li>
00045          *     <li>Value: The value of the command line option.</li>
00046          * </ul>
00047          */
00048         public Hashtable<String, Object> data = null;
00049 
00050         /**
00051          * This attribute contains an error message.
00052          */
00053         public String message = null;
00054 
00055         /**
00056          * Constructor.
00057          * @param in_type This argument represents the type of request (depends on the command selector).
00058          * @param in_data This argument contains the data extracted from the command line.
00059          */
00060         public CliData(int in_type, Hashtable<String, Object> in_data)
00061         {
00062             this.type = in_type;
00063             this.data = in_data;
00064         }
00065 
00066         /**
00067          * Constructor.
00068          * @param in_type This argument represents the type of request.
00069          * @param in_error This argument represents an error message.
00070          */
00071         public CliData(int in_type, String in_error)
00072         {
00073             this.type    = in_type;
00074             this.message = in_error;
00075         }
00076 
00077         /**
00078          * Constructor.
00079          * @param in_type This argument represents the type of request.
00080          */
00081         public CliData(int in_type)
00082         {
00083             this.type = in_type;
00084         }
00085 }