/**************************************************************** * Copyright (C) 2006 LAMS Foundation (http://lamsfoundation.org) * ============================================================= * License Information: http://lamsfoundation.org/licensing/lams/2.0/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2.0 * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * http://www.gnu.org/licenses/gpl.txt * **************************************************************** */ package org.lamsfoundation.lams.build; import java.io.File; import java.io.FilenameFilter; import java.io.IOException; import java.util.LinkedList; import java.util.List; /** *

* View Source *

* * @author Fei Yang */ public class JarFolder implements Comparable { String name; List jars = new LinkedList(); void add(Jar jar){ jars.add(jar); } public int compareTo(Object o) { return name.compareTo(((JarFolder)o).name); } static JarFolder buildJarFolder(File file) throws IOException{ JarFolder folder = new JarFolder(); folder.name = file.getName(); File[] jars = file.listFiles( new FilenameFilter(){ public boolean accept(File dir, String name) { return name.endsWith(".jar"); } } ); for(File jar:jars){ folder.add(Jar.buildJar(jar)); } return folder; } }