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.command.checkout; 020 021import java.util.List; 022 023import org.apache.maven.scm.ScmFile; 024import org.apache.maven.scm.ScmResult; 025 026/** 027 * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a> 028 * @author Olivier Lamy 029 * 030 */ 031public class CheckOutScmResult extends ScmResult { 032 033 private static final long serialVersionUID = 3345964619749320210L; 034 035 private List<ScmFile> checkedOutFiles; 036 037 /** 038 * @since 1.8 039 */ 040 private String revision; 041 042 /** 043 * The relative path of the directory of the checked out project in comparison to the checkout directory, or 044 * an empty String in case the checkout directory equals the project directory. 045 * <p> 046 * With most SCMs, this is just an empty String, meaning that the checkout directory equals the project directory. 047 * But there are cases where within the checkout directory, the directory structure of the 048 * SCM system is repeated. E.g. if you check out the project "my/project" to "/some/dir", the project sources 049 * are actually checked out to "my/project/some/dir". In this example, relativePathProjectDirectory would 050 * contain "my/project". 051 */ 052 protected String relativePathProjectDirectory = ""; 053 054 public CheckOutScmResult(String commandLine, String providerMessage, String commandOutput, boolean success) { 055 super(commandLine, providerMessage, commandOutput, success); 056 } 057 058 public CheckOutScmResult(String commandLine, List<ScmFile> checkedOutFiles) { 059 this(commandLine, null, checkedOutFiles); 060 } 061 062 public CheckOutScmResult(String commandLine, String revision, List<ScmFile> checkedOutFiles) { 063 super(commandLine, null, null, true); 064 065 this.revision = revision; 066 067 this.checkedOutFiles = checkedOutFiles; 068 } 069 070 public CheckOutScmResult(String commandLine, List<ScmFile> checkedOutFiles, String relativePathProjectDirectory) { 071 this(commandLine, null, checkedOutFiles); 072 if (relativePathProjectDirectory != null) { 073 this.relativePathProjectDirectory = relativePathProjectDirectory; 074 } 075 } 076 077 public CheckOutScmResult( 078 String commandLine, String revision, List<ScmFile> checkedOutFiles, String relativePathProjectDirectory) { 079 this(commandLine, revision, checkedOutFiles); 080 if (relativePathProjectDirectory != null) { 081 this.relativePathProjectDirectory = relativePathProjectDirectory; 082 } 083 } 084 085 public CheckOutScmResult(List<ScmFile> checkedOutFiles, ScmResult result) { 086 super(result); 087 088 this.checkedOutFiles = checkedOutFiles; 089 } 090 091 public List<ScmFile> getCheckedOutFiles() { 092 return checkedOutFiles; 093 } 094 095 /** 096 * @return the contents of {@link #relativePathProjectDirectory} 097 * @see #relativePathProjectDirectory 098 */ 099 public String getRelativePathProjectDirectory() { 100 return relativePathProjectDirectory; 101 } 102 103 /** 104 * Checked-out revision. 105 * SCM's that have no revision per repository (or branch) should store <code>null</code> here. 106 * 107 * @return the revision that was checked out. 108 * @since 1.8 109 */ 110 public String getRevision() { 111 return revision; 112 } 113}