class FileUtils {

        public static String getNameFromURI(URI u) {
                if ("file".equalsIgnoreCase(u.getScheme())) {
                        return FilenameUtils.removeExtension(new File(u.getPath()).getName());
                } else {
                        if("jdbc".equalsIgnoreCase(u.getScheme())) {
                            try {
                                u = URI.create(u.getSchemeSpecificPart());
                            } catch (IllegalArgumentException ex) {
                                //Ignore
                            }
                        }
                        String q = u.getQuery();
                        if (q != null && !q.isEmpty()) {
                                // With & parameters
                                String[] pat = q.split("&");
                                for (String aPat : pat) {
                                    if (aPat.toLowerCase().startsWith(TABLE_PARAM)) {
                                        // Extract Table name
                                        return aPat.substring(TABLE_PARAM.length());
                                    } else if (aPat.toLowerCase().startsWith(TABLE_PARAM_JDBC)) {
                                        // Extract Table name
                                        return aPat.substring(TABLE_PARAM_JDBC.length());
                                    }
                                }
                        }
                        String path = u.getPath();
                        if (path != null && !path.isEmpty()) {
                                String[] paths = path.split("/");
                                if(paths.length>=1) {
                                        if(!paths[paths.length-1].isEmpty()) {
                                                return paths[paths.length-1];
                                        }
                                }
                        }
                        
                }
                
                throw new UnsupportedOperationException();
        }

        private  FileUtils();

}