FileDocCategorySizeDatePackage
UniqueNameGenerator.javaAPI DocGlassfish v2 API3308Fri May 04 22:34:50 BST 2007com.sun.enterprise.diagnostics.util

UniqueNameGenerator

public class UniqueNameGenerator extends Object
author
mu125243

Fields Summary
private static final String
AM
private static final String
PM
private static final char
SEPARATOR
private static final char
DATE_SEPARATOR
private static final String
REPORT_JAR
Constructors Summary
public UniqueNameGenerator()
Creates a new instance of UniqueNameGenerator

    
           
      
    
Methods Summary
public static java.lang.StringgetName(java.lang.String target)

param
defaultDir directory in which report is stored
name
name of the target for which report is being generated
return
name of diagnostic report

        Calendar calendar = Calendar.getInstance();
        String am_pm = calendar.get(Calendar.AM_PM) == 0? AM : PM;
        int month =  calendar.get(Calendar.MONTH) + 1;
        String dateValue =  "" + month +
                calendar.get(Calendar.DAY_OF_MONTH) + 
                calendar.get(Calendar.YEAR);
        String dateTime = ""+calendar.get(Calendar.HOUR_OF_DAY) + 
               SEPARATOR + calendar.get(Calendar.MINUTE) + am_pm;
        String fileName =   target + SEPARATOR +
                dateValue + DATE_SEPARATOR + dateTime + SEPARATOR + REPORT_JAR;
 
        return fileName;