Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AbstractRepositoryConsumer |
|
| 1.0;1 |
1 | package org.apache.maven.scm.provider.jazz.command.consumer; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one | |
5 | * or more contributor license agreements. See the NOTICE file | |
6 | * distributed with this work for additional information | |
7 | * regarding copyright ownership. The ASF licenses this file | |
8 | * to you under the Apache License, Version 2.0 (the | |
9 | * "License"); you may not use this file except in compliance | |
10 | * with the License. You may obtain a copy of the License at | |
11 | * | |
12 | * http://www.apache.org/licenses/LICENSE-2.0 | |
13 | * | |
14 | * Unless required by applicable law or agreed to in writing, | |
15 | * software distributed under the License is distributed on an | |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
17 | * KIND, either express or implied. See the License for the | |
18 | * specific language governing permissions and limitations | |
19 | * under the License. | |
20 | */ | |
21 | ||
22 | import org.apache.maven.scm.log.ScmLogger; | |
23 | import org.apache.maven.scm.provider.ScmProviderRepository; | |
24 | import org.apache.maven.scm.util.AbstractConsumer; | |
25 | ||
26 | /** | |
27 | * An extension of the AbstractConsumer class that also holds our Repository. | |
28 | */ | |
29 | public abstract class AbstractRepositoryConsumer | |
30 | extends AbstractConsumer | |
31 | { | |
32 | // The repository that we are working with. | |
33 | 32 | private ScmProviderRepository repository = null; |
34 | ||
35 | // Have we processed input? | |
36 | 32 | protected boolean fed = false; |
37 | ||
38 | /** | |
39 | * AbstractRepositoryConsumer constructor. | |
40 | * | |
41 | * @param logger The logger to use in the consumer | |
42 | */ | |
43 | public AbstractRepositoryConsumer( ScmProviderRepository repository, ScmLogger logger ) | |
44 | { | |
45 | 32 | super( logger ); |
46 | 32 | setRepository( repository ); |
47 | 32 | } |
48 | ||
49 | /** | |
50 | * @return The repository. | |
51 | */ | |
52 | public ScmProviderRepository getRepository() | |
53 | { | |
54 | 14 | return repository; |
55 | } | |
56 | ||
57 | /** | |
58 | * @param repository The repository to set. | |
59 | */ | |
60 | public void setRepository( ScmProviderRepository repository ) | |
61 | { | |
62 | 32 | this.repository = repository; |
63 | 32 | } |
64 | ||
65 | /** | |
66 | * @return The fed. | |
67 | */ | |
68 | public boolean isFed() | |
69 | { | |
70 | 2 | return fed; |
71 | } | |
72 | ||
73 | /** | |
74 | * @param fed The fed to set. | |
75 | */ | |
76 | public void setFed( boolean fed ) | |
77 | { | |
78 | 0 | this.fed = fed; |
79 | 0 | } |
80 | ||
81 | /** | |
82 | * Process one line of output from the execution of the "scm xxxx" command. | |
83 | * | |
84 | * @param line The line of output from the external command that has been pumped to us. | |
85 | * @see org.codehaus.plexus.util.cli.StreamConsumer#consumeLine(java.lang.String) | |
86 | */ | |
87 | public void consumeLine( String line ) | |
88 | { | |
89 | 143 | getLogger().debug( "Consumed line :" + line ); |
90 | 143 | this.fed = true; |
91 | 143 | } |
92 | } |