001 package org.apache.maven.scm;
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.repository.ScmRepository;
023
024 import java.io.Serializable;
025
026 /**
027 * Base class for SCM wrapped parameters.
028 * Unlike {@link ScmResult}, this is mutable, as its use requires more flexibility when configuring the call.
029 * <p>Most parameters should be stored in {@link #getCommandParameters() parameters} field, as it makes them easy to pass
030 * down to the implementation side.</p>
031 * <p>
032 * Methods in descendant classes should perform all neccessary (un)marshalling so that user can work with nice
033 * semantic typesafe properties.</p>
034 *
035 * @author Petr Kozelka
036 * @since 1.8
037 */
038 public class ScmRequest
039 implements Serializable
040 {
041 private static final long serialVersionUID = 20120620L;
042
043 private ScmRepository scmRepository;
044
045 private ScmFileSet scmFileSet;
046
047 protected final CommandParameters parameters = new CommandParameters();
048
049 public ScmRequest()
050 {
051 // no op
052 }
053
054 public ScmRequest( ScmRepository scmRepository, ScmFileSet scmFileSet )
055 {
056 this.scmRepository = scmRepository;
057 this.scmFileSet = scmFileSet;
058 }
059
060 public ScmRepository getScmRepository()
061 {
062 return scmRepository;
063 }
064
065 /**
066 * @param scmRepository the source control system
067 */
068 public void setScmRepository( ScmRepository scmRepository )
069 {
070 this.scmRepository = scmRepository;
071 }
072
073 public ScmFileSet getScmFileSet()
074 {
075 return scmFileSet;
076 }
077
078 /**
079 * The files being processed. Implementations can also work with all files from the
080 * {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
081 * @param scmFileSet working copy and its selected files
082 */
083 public void setScmFileSet( ScmFileSet scmFileSet )
084 {
085 this.scmFileSet = scmFileSet;
086 }
087
088 /**
089 * Holds all parameter values passed to the implementing part.
090 * These parameters are usually translated to commandline options or arguments.
091 * @return command parameters
092 */
093 public CommandParameters getCommandParameters()
094 {
095 return parameters;
096 }
097 }