001 package org.apache.maven.scm.provider.jazz.command.list;
002
003 /*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements. See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership. The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License. You may obtain a copy of the License at
011 *
012 * http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied. See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022 import org.apache.maven.scm.ScmFile;
023 import org.apache.maven.scm.ScmFileStatus;
024 import org.apache.maven.scm.log.ScmLogger;
025 import org.apache.maven.scm.provider.ScmProviderRepository;
026 import org.apache.maven.scm.provider.jazz.command.consumer.AbstractRepositoryConsumer;
027
028 import java.util.ArrayList;
029 import java.util.List;
030
031 /**
032 * Consume the output of the scm command for the "list" operation.
033 *
034 * @author <a href="mailto:ChrisGWarp@gmail.com">Chris Graham</a>
035 */
036 public class JazzListConsumer
037 extends AbstractRepositoryConsumer
038 {
039 private List<ScmFile> files = new ArrayList<ScmFile>();
040
041 /**
042 * Construct the JazzListCommand consumer.
043 *
044 * @param repository The repository we are working with.
045 * @param logger The logger to use.
046 */
047 public JazzListConsumer( ScmProviderRepository repository, ScmLogger logger )
048 {
049 super( repository, logger );
050 }
051
052 /**
053 * Process one line of output from the execution of the "scm list" command.
054 *
055 * @param line The line of output from the external command that has been pumped to us.
056 * @see org.codehaus.plexus.util.cli.StreamConsumer#consumeLine(java.lang.String)
057 */
058 public void consumeLine( String line )
059 {
060 super.consumeLine( line );
061 files.add( new ScmFile( line, ScmFileStatus.CHECKED_IN ) );
062 }
063
064 public List<ScmFile> getFiles()
065 {
066 return files;
067 }
068 }