001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.maven.scm;
020
021import java.io.Serializable;
022
023import org.apache.maven.scm.repository.ScmRepository;
024
025/**
026 * Base class for SCM wrapped parameters.
027 * Unlike {@link ScmResult}, this is mutable, as its use requires more flexibility when configuring the call.
028 * <p>Most parameters should be stored in {@link #getCommandParameters() parameters} field, as it makes them easy to
029 * pass down to the implementation side.</p>
030 * <p>
031 * Methods in descendant classes should perform all neccessary (un)marshalling so that user can work with nice
032 * semantic typesafe properties.</p>
033 *
034 * @author Petr Kozelka
035 * @since 1.8
036 */
037public class ScmRequest implements Serializable {
038    private static final long serialVersionUID = 20120620L;
039
040    private ScmRepository scmRepository;
041
042    private ScmFileSet scmFileSet;
043
044    protected final CommandParameters parameters = new CommandParameters();
045
046    public ScmRequest() {
047        // no op
048    }
049
050    public ScmRequest(ScmRepository scmRepository, ScmFileSet scmFileSet) {
051        this.scmRepository = scmRepository;
052        this.scmFileSet = scmFileSet;
053    }
054
055    public ScmRepository getScmRepository() {
056        return scmRepository;
057    }
058
059    /**
060     * @param scmRepository the source control system
061     */
062    public void setScmRepository(ScmRepository scmRepository) {
063        this.scmRepository = scmRepository;
064    }
065
066    public ScmFileSet getScmFileSet() {
067        return scmFileSet;
068    }
069
070    /**
071     * The files being processed. Implementations can also work with all files from the
072     *      {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
073     * @param scmFileSet working copy and its selected files
074     */
075    public void setScmFileSet(ScmFileSet scmFileSet) {
076        this.scmFileSet = scmFileSet;
077    }
078
079    /**
080     * Holds all parameter values passed to the implementing part.
081     * These parameters are usually translated to commandline options or arguments.
082     * @return command parameters
083     */
084    public CommandParameters getCommandParameters() {
085        return parameters;
086    }
087}