View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.scm;
20  
21  import java.io.Serializable;
22  
23  import org.apache.maven.scm.repository.ScmRepository;
24  
25  /**
26   * Base class for SCM wrapped parameters.
27   * Unlike {@link ScmResult}, this is mutable, as its use requires more flexibility when configuring the call.
28   * <p>Most parameters should be stored in {@link #getCommandParameters() parameters} field, as it makes them easy to
29   * pass down to the implementation side.</p>
30   * <p>
31   * Methods in descendant classes should perform all neccessary (un)marshalling so that user can work with nice
32   * semantic typesafe properties.</p>
33   *
34   * @author Petr Kozelka
35   * @since 1.8
36   */
37  public class ScmRequest implements Serializable {
38      private static final long serialVersionUID = 20120620L;
39  
40      private ScmRepository scmRepository;
41  
42      private ScmFileSet scmFileSet;
43  
44      protected final CommandParameters parameters = new CommandParameters();
45  
46      public ScmRequest() {
47          // no op
48      }
49  
50      public ScmRequest(ScmRepository scmRepository, ScmFileSet scmFileSet) {
51          this.scmRepository = scmRepository;
52          this.scmFileSet = scmFileSet;
53      }
54  
55      public ScmRepository getScmRepository() {
56          return scmRepository;
57      }
58  
59      /**
60       * @param scmRepository the source control system
61       */
62      public void setScmRepository(ScmRepository scmRepository) {
63          this.scmRepository = scmRepository;
64      }
65  
66      public ScmFileSet getScmFileSet() {
67          return scmFileSet;
68      }
69  
70      /**
71       * The files being processed. Implementations can also work with all files from the
72       *      {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
73       * @param scmFileSet working copy and its selected files
74       */
75      public void setScmFileSet(ScmFileSet scmFileSet) {
76          this.scmFileSet = scmFileSet;
77      }
78  
79      /**
80       * Holds all parameter values passed to the implementing part.
81       * These parameters are usually translated to commandline options or arguments.
82       * @return command parameters
83       */
84      public CommandParameters getCommandParameters() {
85          return parameters;
86      }
87  }