image
 
image
Const.java


/*::.
==================================================================================================================================
=================================================¦ Copyright © 2004 Allen Baker ¦=================================================
                                                 +------------------------------+
File:       Const.java
Originator: Allen Baker (2004.01.16)
LayoutRev:  5
================================================================================================================================== */



/*.
==========================================================================================
Package
------------------------------------------------------------------------------------------ */
package cosmicabyss.com.lib;



/*.
==========================================================================================
Imports
------------------------------------------------------------------------------------------ */
import java.io.*;
import java.util.*;



/*::
======================================================================================================================== *//**
Instances of this class are made up of static constants that are potentially common to more than one of the other
classes in this package. They are used instead of literals in the other classes to eliminate the problems of
misspellings and wrong character case. Use of these constants instead of the actual literals also makes maintenance
easier. If a literal needs to be changed, it only has to be changed in this file, not in every file where the constant
is used.

<P>
   <DL>
      <DT>
         <B>
            Example usage:
         </B>
         <DD>
            <BLOCKQUOTE>
               <PRE id="unindent">
                  no example provided
               </PRE>
            </BLOCKQUOTE>
         </DD>
      </DT>
      <DT>
         <B>
            View Source:
         </B>
         <DD>
            <A href="Const.java.html">
               Const.java
            </A>
         </DD>
      </DT>
   </DL>

@author
   <A href="mailto:allen_baker@hp.com">
      Allen Baker
   </A>
*//*
======================================================================================================================== */
public class Const
   {



   /*.
   ==========================================================================================
   Property names
   ------------------------------------------------------------------------------------------ */
   public static final XString  PROP_LOG_DIRECTORY = new XString("LOGDIRECTORY");
   /*.
   ==========================================================================================
   Directories and files
   ------------------------------------------------------------------------------------------ */
   public static final XString  BKUPDIR = new XString("C:/ABDITORY/Protected/Backup/");
   public static final XString  USEDPWD = new XString("C:/ABDITORY/Protected/ADMIN/HashValues.txt");
   /*.
   ==========================================================================================
   Severity codes
   ------------------------------------------------------------------------------------------ */
   public static final int  CRITICAL = 1;
   public static final int  HALT     = 2;
   public static final int  NOHALT   = 3;
   public static final int  WARNING  = 4;
   /*.
   ==========================================================================================
   xString representations of severity codes
   ------------------------------------------------------------------------------------------ */
   public static final XString  STR_CRITICAL = new XString("ERROR (CRITICAL)");
   public static final XString  STR_HALT     = new XString("ERROR (HALT)");
   public static final XString  STR_NOHALT   = new XString("ERROR (NOHALT)");
   public static final XString  STR_WARNING  = new XString("WARNING");
   /*.
   ==========================================================================================
   Console Box Drawing Characters
   ------------------------------------------------------------------------------------------ */
   public static final char  CHAR_LIGHT_HORIZONTAL                   = '\u2500';
   public static final char  CHAR_LIGHT_VERTICAL                     = '\u2502';
   public static final char  CHAR_LIGHT_UP_AND_RIGHT                 = '\u2514';
   public static final char  CHAR_LIGHT_UP_AND_LEFT                  = '\u2518';
   public static final char  CHAR_DOUBLE_HORIZONTAL                  = '\u2550';
   public static final char  CHAR_DOUBLE_VERTICAL                    = '\u2551';
   public static final char  CHAR_VERTICAL_SINGLE_AND_RIGHT_DOUBLE   = '\u255E';
   public static final char  CHAR_VERTICAL_SINGLE_AND_LEFT_DOUBLE    = '\u2561';
   public static final char  CHAR_DOUBLE_VERTICAL_AND_RIGHT          = '\u2560';
   public static final char  CHAR_DOUBLE_VERTICAL_AND_LEFT           = '\u2563';
   public static final char  CHAR_DOWN_SINGLE_AND_HORIZONTAL_DOUBLE  = '\u2564';
   public static final char  CHAR_DOUBLE_DOWN_AND_HORIZONTAL         = '\u2566';
   public static final char  CHAR_DOUBLE_UP_AND_HORIZONTAL           = '\u2569';
   public static final char  CHAR_DOUBLE_VERTICAL_AND_HORIZONTAL     = '\u256C';
   public static final char  CHAR_FULL_BLOCK                         = '\u2588';
   public static final char  CHAR_BLACK_SQUARE                       = '\u25A0';
   /*.
   ==========================================================================================
   Strings used for testing
   ------------------------------------------------------------------------------------------ */
   public static final XString  EMERGENCY_TEST = new XString
      (
      "This is a test of the emergency broadcast system. The broadcasters of your area in voluntary cooperation with the "   +
      "federal, state and local authorities have developed this system to keep you informed in the event of an emergency. "  +
      "If this had been an actual emergency, the attention signal you just heard would have been followed by official "      +
      "information, news or instructions. This station serves the Pecos Valley and Southeastern New Mexico area. This "      +
      "concludes this test of the emergency broadcast system."
      );
   public static final XString  EMERGENCY = new XString
      (
      "We interrupt this program. This is a national emergency. The President of the United States or his designated "       +
      "representative will appear shortly over the Emergency Broadcast System."
      );
   /*.
   ==========================================================================================
   Regular expressions for finding things in source code and HTML files etc..
   ------------------------------------------------------------------------------------------ */
   public static final String  REGEX_PRE_START_TAG      = "<PRE.*?>";
   public static final String  REGEX_CODE_START_TAG     = "<CODE.*?>";
   public static final String  REGEX_PRE_END_TAG        = "</PRE>";
   public static final String  REGEX_CODE_END_TAG       = "</CODE>";
   public static final String  REGEX_LINE_COMMENT_START = "^[\\*]//^[\\*]";
   public static final String  REGEX_LINE_COMMENT_END   = "\\n";
   /*.
   ==========================================================================================
   Try to keep lines formatted for output to the console display at or under this many chars
   ------------------------------------------------------------------------------------------ */
   public static final int  CONSOLE_DISPLAY_WIDTH =
      (
      ConsoleInfo.width() - (int)(ConsoleInfo.width() / UMath.pow(UMath.PHI, 4))
      );


   /*:.
   ==============================================================================================================
   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@[  Protected  ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   ============================================================================================================== */



   /*:.
   ==============================================================================================================
   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@[  Private  ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   ============================================================================================================== */



   /*:.
   ==============================================================================================================
   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@[  Inner Classes  ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   ============================================================================================================== */



   /*:.
   ==============================================================================================================
   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@[  Public Static Methods  ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   ============================================================================================================== */



   /*:                                    :METHOD:000:BOOKMARK:
   ====================================================================================================
   [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
   ==================================================================================================== *//**
   This method returns the XString representation of the severity code.

   <P><B>Implementation: </B><A HREF="Const.java.html#000">View source</A>

   @return
      The XString representation of the severity code

   @param
      pSeverity is the severity code to translate into a descriptive XString
   *//*
   ---------------------------------------------------------------------------------------------------- */
   public static XString code2Str(int pSeverity)
      {
      switch (pSeverity)
         {
         case Const.CRITICAL:  return Const.STR_CRITICAL;
         case Const.HALT:      return Const.STR_HALT;
         case Const.NOHALT:    return Const.STR_NOHALT;
         case Const.WARNING:   return Const.STR_WARNING;
         }
      return new XString("");
      }



   /*:                                    :METHOD:001:BOOKMARK:
   ====================================================================================================
   [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
   ==================================================================================================== *//**
   This method returns the XString representation of the severity code.

   <P><B>Implementation: </B><A HREF="Const.java.html#001">View source</A>

   @return
      The XString representation of the severity code

   @param
      pSeverity is the severity code to translate into a descriptive XString
   *//*
   ---------------------------------------------------------------------------------------------------- */
   public static XString code2XStr(int pSeverity)
      {
      switch (pSeverity)
         {
         case Const.CRITICAL:  return new XString(Const.STR_CRITICAL);
         case Const.HALT:      return new XString(Const.STR_HALT);
         case Const.NOHALT:    return new XString(Const.STR_NOHALT);
         case Const.WARNING:   return new XString(Const.STR_WARNING);
         }
      return new XString("");
      }



   /*:                                    :METHOD:002:BOOKMARK:
   ====================================================================================================
   [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
   ==================================================================================================== *//**
   This method allows the Const class file to be unit tested as a stand-alone application. It's the
   method that's called when the class is invoked from the command line by using the java application
   launcher - "java". Main is not a required method, but the practice of putting one in each class and
   wrapping class test code within it allows easy unit testing of the class; and main does not need to
   be removed when testing is complete.

   <P>
      <DL>
         <DT>
            <B>
               Command line usage:
            </B>
            <DD>
               Java com.hp.ces.provision.Const
            </DD>
         </DT>
      </DL>

   <P><B>Implementation: </B><A HREF="Const.java.html#002">View source</A>

   @param
      pArgs contains the command line arguments with which the class was invoked as an application.
   *//*
   ---------------------------------------------------------------------------------------------------- */
   public static void main(String[] pArgs) throws Exception
      {
      /*.
      ==========================================================================================
      Print the names of the columns in the provisioning db
      ------------------------------------------------------------------------------------------ */
      System.out.println(Const.PROP_LOG_DIRECTORY);
      System.out.println(Const.CONSOLE_DISPLAY_WIDTH);
      }



   }  // class Const