001 package org.apache.maven.scm.provider.jazz.command.consumer;
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.log.ScmLogger;
023 import org.apache.maven.scm.provider.ScmProviderRepository;
024 import org.apache.maven.scm.util.AbstractConsumer;
025
026 /**
027 * An extension of the AbstractConsumer class that also holds our Repository.
028 */
029 public abstract class AbstractRepositoryConsumer
030 extends AbstractConsumer
031 {
032 // The repository that we are working with.
033 private ScmProviderRepository repository = null;
034
035 // Have we processed input?
036 protected boolean fed = false;
037
038 /**
039 * AbstractRepositoryConsumer constructor.
040 *
041 * @param logger The logger to use in the consumer
042 */
043 public AbstractRepositoryConsumer( ScmProviderRepository repository, ScmLogger logger )
044 {
045 super( logger );
046 setRepository( repository );
047 }
048
049 /**
050 * @return The repository.
051 */
052 public ScmProviderRepository getRepository()
053 {
054 return repository;
055 }
056
057 /**
058 * @param repository The repository to set.
059 */
060 public void setRepository( ScmProviderRepository repository )
061 {
062 this.repository = repository;
063 }
064
065 /**
066 * @return The fed.
067 */
068 public boolean isFed()
069 {
070 return fed;
071 }
072
073 /**
074 * @param fed The fed to set.
075 */
076 public void setFed( boolean fed )
077 {
078 this.fed = fed;
079 }
080
081 /**
082 * Process one line of output from the execution of the "scm xxxx" command.
083 *
084 * @param line The line of output from the external command that has been pumped to us.
085 * @see org.codehaus.plexus.util.cli.StreamConsumer#consumeLine(java.lang.String)
086 */
087 public void consumeLine( String line )
088 {
089 getLogger().debug( "Consumed line :" + line );
090 this.fed = true;
091 }
092 }