jpl.mipl.cassini.CDRS.qviewer.core.util
Class AddProductToDBObj

java.lang.Object
  extended by jpl.mipl.cassini.CDRS.qviewer.core.util.AddProductToDBObj

public class AddProductToDBObj
extends Object

Author:
rrp Adds the given product to the database.

Constructor Summary
AddProductToDBObj(Connection conn)
          Construct the object using the given connection.
AddProductToDBObj(String username, String password, String databasename, String servername)
          Construct new object using database login info.
 
Method Summary
 void addIssProduct(String pFileName, String fType, String userName, String description, boolean predictsRequired, long reqId, int jobId, int reasonCode)
          Adds the given product to ISS product table.
 void addProduct(String productFileName, String fType, String userName, String description, boolean predictsRequired, long reqId, int jobId, int reasonCode)
          Adds the given product to ISS or VIMS product table depending on the productFileName.
 void addVimsProduct(String pFileName, String fType, String userName, String description, boolean predictsRequired, long reqId, int jobId, int reasonCode)
          Adds the given product to VIMS product table.
 void finalize()
           
static String getIssImageFileName(String fname)
          Retrun an image file name corresponding to the given fname.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddProductToDBObj

public AddProductToDBObj(String username,
                         String password,
                         String databasename,
                         String servername)
                  throws Exception
Construct new object using database login info.

Parameters:
username - Database user name.
password - if null, password server will be used
databasename - database to connect to
servername - server where the database resides
predictsRequired - if true and no predicts are found, the process will exit. Otherwise it will use predicts if found.
Throws:
Exception

AddProductToDBObj

public AddProductToDBObj(Connection conn)
Construct the object using the given connection.

Parameters:
conn - A valid connection to database.
Method Detail

addProduct

public void addProduct(String productFileName,
                       String fType,
                       String userName,
                       String description,
                       boolean predictsRequired,
                       long reqId,
                       int jobId,
                       int reasonCode)
                throws Exception
Adds the given product to ISS or VIMS product table depending on the productFileName. This method can be called multiple times on the same object with different product types.

Parameters:
productName - The name of the product to be added.
fType - The FEI file type to which this product is added to.
description - reason for manual add
predictsRequired - if true, product will only be added if exactly one predict is found for the product.
reqId - the request id for which the product is to be added
jobId - the job id for which the product is to be added
Throws:
IllegalArgumentException - if the product file name is null or zero length string.
Exception

addIssProduct

public void addIssProduct(String pFileName,
                          String fType,
                          String userName,
                          String description,
                          boolean predictsRequired,
                          long reqId,
                          int jobId,
                          int reasonCode)
                   throws Exception
Adds the given product to ISS product table. This method obtains necessary attributes from image labels and predict table.

Parameters:
productFileName - A complete path name of file to be added
description - reason for manual add
Throws:
Excepion - IllegalArgumentException if the given productFileName is null or zero value file and exceptions thrown by other classes.
Exception

addVimsProduct

public void addVimsProduct(String pFileName,
                           String fType,
                           String userName,
                           String description,
                           boolean predictsRequired,
                           long reqId,
                           int jobId,
                           int reasonCode)
                    throws Exception
Adds the given product to VIMS product table. This method obtains necessary attributes from given cube labels and predict table.

Parameters:
productFileName - name of cube file to be added
description - reason for manual add
Throws:
Excepion
Exception

finalize

public void finalize()
Overrides:
finalize in class Object

getIssImageFileName

public static String getIssImageFileName(String fname)
Retrun an image file name corresponding to the given fname.

Parameters:
fname - The name of label (or image) file.
Returns:
The following: input output N1547346012.017-155922 N1547346012.017-155922 N1547346012_2.IMG N1547346012_2.IMG N1547346012.017-155922.LBL N1547346012.017-155922 N1547346012.017-155922.IMG N1547346012.017-155922.IMG N1547346012_2.LBL N1547346012_2.IMG if an absolute path name is provided, the path is not stripped off.