class HMSDebuggerComponent {

    public boolean cleanHmsDebugLogs( String logArchiveDirectoryName )
        throws HmsException
    {
        logger.debug( "In cleanHmsDebugLogs(), trying to delete logs in this directory [ " + logArchiveDirectoryName
            + " ]" );
        if ( logArchiveDirectoryName != null )
        {
            File logArchiveName = new File( logArchiveDirectoryName );
            if ( logArchiveName.exists() && logArchiveName.isDirectory() && logArchiveName.canWrite() )
            {
                for ( File archive : logArchiveName.listFiles() )
                {
                    if ( archive.getName().matches( HMS_ARCHIVE_REGEX ) )
                    {
                        try
                        {
                            if ( isFileDeleteable( archive.getName() ) )
                            {
                                archive.delete();
                            }
                        }
                        catch ( Exception e )
                        {
                            logger.error( "Unable to delete log archive [ " + archive.getName() + " ] from filesystem.",
                                          e );
                        }
                    }
                }
                return true;
            }
            else
            {
                String err = "[ " + logArchiveDirectoryName + " ] doesnot exist or is not a directory.";
                logger.error( err );
                throw new HmsException( err );
            }
        }
        else
        {
            String err = "Absolute path for log directory [ " + logArchiveDirectoryName + " ] cannot be null";
            logger.error( err );
            throw new HmsException( err );
        }
    }

}