001 /**
002 * Copyright 2008-2012 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.codehaus.mojo.wagon;
017
018 import java.util.List;
019
020 import org.apache.maven.plugin.MojoExecutionException;
021 import org.apache.maven.wagon.Wagon;
022 import org.apache.maven.wagon.WagonException;
023 import org.codehaus.mojo.wagon.shared.WagonFileSet;
024
025 /**
026 * List the files under a specified directory for a repository
027 *
028 * @goal list
029 * @requiresProject false
030 */
031 public class ListMojo extends AbstractWagonListMojo {
032
033 /**
034 * If true, any files found are logged to the console
035 *
036 * @parameter expression="${wagon.showFiles}" default-value="true"
037 */
038 protected boolean showFiles;
039
040 @Override
041 protected void execute(Wagon wagon) throws MojoExecutionException, WagonException {
042 WagonFileSet wagonFileSet = getWagonFileSet();
043 List<String> files = wagonDownload.getFileList(wagon, wagonFileSet, getLog());
044 if (showFiles) {
045 for (String file : files) {
046 getLog().info(file);
047 }
048 }
049 }
050
051 public boolean isShowFiles() {
052 return showFiles;
053 }
054
055 public void setShowFiles(boolean showFiles) {
056 this.showFiles = showFiles;
057 }
058 }