HiRISE

HiRISE.HiCat.Utilities
Class Product_Version

java.lang.Object
  extended by HiRISE.HiCat.Utilities.Product_Version

public class Product_Version
extends Object

A class for getting and generating new Product Version ID's.

Given a HiRISE Product_ID, and an appropriate database, a set of PVL parameters is generated which returns the Product_ID, the maximum version number of a product that exists in the HiCat database, the version id of the currently proffered product, and the version id that should be used to create a new version of a product. The version id is expected to be an integer, and only integers will be accepted as possible version id's.

Versioning Policy

The default versioning policy works as follows: The value of the Next_Version parameter will be determined by the Max_Version parameter and the Proffered_Version parameter. The Next_Version parameter will always be the larger of the Proffered_Version + 1, or the Max_Version. For example, if the Max_Version equals the Proffered_Version, then the Next_Version will be the Proffered_Version + 1. However, if the Max_Version is greater than the Proffered_Version, then the Next_Version will be the Max_Version.

The default method can be over-ridden in two ways. The next version id can be forced to be a given ID using the -Use_version option on the command line, or by using the -No_increment option which will cause the next ID to be the same as the currently proffered id. See Usage()

Parameter Output

The pvl parameter set returned by this utility looks something like this:

Software_ID = "HiRISE.HiCat.Utilities.Product_Version (1.18 2008/10/09 20:52:44)"
GROUP = Version_Data
        Product_ID = PSP_003639_1345_RED4_0
        Max_Version = 1
        Proffered_Version = 1
        Next_Version = 2
END_GROUP

Version:
1.18
Author:
Rodney Heyd UA/PIRL

Field Summary
static String DEFAULT_CONFIGURATION_FILENAME
           
static String DEFAULT_CONFIGURATION_PATH
           
static int EXIT_CONFIGURATION_ERROR
           
static int EXIT_DATABASE_ERROR
           
static int EXIT_INVALID_COMMAND_LINE_SYNTAX
           
static int EXIT_IO_ERROR
           
static int EXIT_PVL_ERROR
           
static int EXIT_SUCCESS
           
static String ID
           
 
Constructor Summary
Product_Version(Database database, String catalog)
          Construct a Product_Version object given a database and catalog.
Product_Version(Database database, String catalog, boolean increment_version)
          Construct a Product_Version object
 
Method Summary
 int Force_Version_ID()
          Get the current forced version_id being used.
 int Force_Version_ID(int version_id)
          Forces the value of the next version parameter to be the argument to this method.
 boolean Increment_Version()
          Get the current status of the Increment_Version rule.
 boolean Increment_Version(boolean increment_version)
          Sets the increment version rule.
static void main(String[] arguments)
          Command line usage.
static String Product_ID_Check(String product_string)
          Checks to see if the input string can be parsed into a standard HiRISE PDS Product ID.
static void Usage()
          Prints the command line usage syntax.
 Parameter Version_Information(String product_id)
          Gets the version information for the specified product_id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final String ID
See Also:
Constant Field Values

DEFAULT_CONFIGURATION_FILENAME

public static final String DEFAULT_CONFIGURATION_FILENAME
See Also:
Constant Field Values

DEFAULT_CONFIGURATION_PATH

public static final String DEFAULT_CONFIGURATION_PATH
See Also:
Constant Field Values

EXIT_SUCCESS

public static final int EXIT_SUCCESS
See Also:
Constant Field Values

EXIT_INVALID_COMMAND_LINE_SYNTAX

public static final int EXIT_INVALID_COMMAND_LINE_SYNTAX
See Also:
Constant Field Values

EXIT_CONFIGURATION_ERROR

public static final int EXIT_CONFIGURATION_ERROR
See Also:
Constant Field Values

EXIT_DATABASE_ERROR

public static final int EXIT_DATABASE_ERROR
See Also:
Constant Field Values

EXIT_PVL_ERROR

public static final int EXIT_PVL_ERROR
See Also:
Constant Field Values

EXIT_IO_ERROR

public static final int EXIT_IO_ERROR
See Also:
Constant Field Values
Constructor Detail

Product_Version

public Product_Version(Database database,
                       String catalog)
                throws Database_Exception
Construct a Product_Version object given a database and catalog.

Parameters:
database - The database object to query for product data.
catalog - The database catalog containing the appropriate tables.
Throws:
Database_Exception
See Also:
Database

Product_Version

public Product_Version(Database database,
                       String catalog,
                       boolean increment_version)
                throws Database_Exception
Construct a Product_Version object

Parameters:
database - The Database object to query for product data.
catalog - The database catalog containing the appropriate tables
increment_version - boolean value, if true, the next version parameter will be incremented by 1 above the proffered version.
Throws:
Database_Exception
See Also:
Database
Method Detail

Version_Information

public Parameter Version_Information(String product_id)
                              throws Database_Exception,
                                     PVL_Exception
Gets the version information for the specified product_id.

Parameters:
product_id - the product_id for which version information is desired.
Returns:
A set of Parameters containing the version information.
Throws:
Database_Exception
PVL_Exception

Product_ID_Check

public static String Product_ID_Check(String product_string)
                               throws Invalid_Argument_Exception,
                                      Out_of_Range_Exception
Checks to see if the input string can be parsed into a standard HiRISE PDS Product ID. This method will attempt to parse the input string into either an EDR or an RDR Product ID. If the input string looks like a filename, then any leading path information is removed from the string, and any file extensions are also removed. The observation ID is then extracted, and if successful, then the remaining product ID information is parsed. If each of these steps is successful, then the derived product ID is returned.

**Note: It is likely that this method will eventually be moved into a subclass of HiRISE.libHiRISE.Observation_ID

Parameters:
product_string - a string containing a HiRISE product ID
Returns:
product_id - a product ID string with any superfluous text removed.
Throws:
Invalid_Argument_Exception
Out_of_Range_Exception
See Also:
Observation_ID

Force_Version_ID

public int Force_Version_ID(int version_id)
Forces the value of the next version parameter to be the argument to this method.

Parameters:
version_id - the version_id to be returned in the parameter set.
Returns:
the previous value of the version id (default: 0)

Force_Version_ID

public int Force_Version_ID()
Get the current forced version_id being used.

Returns:
the currnet version id in use by the object.

Increment_Version

public boolean Increment_Version(boolean increment_version)
Sets the increment version rule.

Parameters:
increment_version - If false, the next version will be the same as the currently proffered version. If true, the next version will be incremented by one above the proffered version.
Returns:
the Increment_Version status prior to resetting it.

Increment_Version

public boolean Increment_Version()
Get the current status of the Increment_Version rule.

Returns:
true or false
See Also:
Increment_Version(boolean)

main

public static void main(String[] arguments)
Command line usage.

The exit status will be one of the following:

Parameters:
arguments -
See Also:
Usage()

Usage

public static void Usage()
Prints the command line usage syntax.

Usage: Product_Version <Options>
  Options -
    [-Catalog <Catalog_Name>
    [-Configuration <filename>
      (default: HIROC.conf)
    [-No_increment]
    [-Product_ID <ID String>]
    [-Use_version <integer>]
    [-Verbose]
    [-Help]


HiRISE

Copyright \ (C) Arizona Board of Regents on behalf of the \ Planetary Image Research Laboratory, Lunar and \ Planetary Laboratory at the University of Arizona