View Javadoc
1   package org.apache.maven.scm;
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.repository.ScmRepository;
23  
24  import java.io.Serializable;
25  
26  /**
27   * Base class for SCM wrapped parameters.
28   * Unlike {@link ScmResult}, this is mutable, as its use requires more flexibility when configuring the call.
29   * <p>Most parameters should be stored in {@link #getCommandParameters() parameters} field, as it makes them easy to pass
30   * down to the implementation side.</p>
31   * <p>
32   * Methods in descendant classes should perform all neccessary (un)marshalling so that user can work with nice
33   * semantic typesafe properties.</p>
34   *
35   * @author Petr Kozelka
36   * @since 1.8
37   */
38  public class ScmRequest
39      implements Serializable
40  {
41      private static final long serialVersionUID = 20120620L;
42  
43      private ScmRepository scmRepository;
44  
45      private ScmFileSet scmFileSet;
46  
47      protected final CommandParameters parameters = new CommandParameters();
48  
49      public ScmRequest()
50      {
51          // no op
52      }
53  
54      public ScmRequest( ScmRepository scmRepository, ScmFileSet scmFileSet )
55      {
56          this.scmRepository = scmRepository;
57          this.scmFileSet = scmFileSet;
58      }
59  
60      public ScmRepository getScmRepository()
61      {
62          return scmRepository;
63      }
64  
65      /**
66       * @param scmRepository the source control system
67       */
68      public void setScmRepository( ScmRepository scmRepository )
69      {
70          this.scmRepository = scmRepository;
71      }
72  
73      public ScmFileSet getScmFileSet()
74      {
75          return scmFileSet;
76      }
77  
78      /**
79       * The files being processed. Implementations can also work with all files from the
80       *      {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
81       * @param scmFileSet working copy and its selected files
82       */
83      public void setScmFileSet( ScmFileSet scmFileSet )
84      {
85          this.scmFileSet = scmFileSet;
86      }
87  
88      /**
89       * Holds all parameter values passed to the implementing part.
90       * These parameters are usually translated to commandline options or arguments.
91       * @return command parameters
92       */
93      public CommandParameters getCommandParameters()
94      {
95          return parameters;
96      }
97  }