| 1 |
package org.apache.maven.scm.command.checkout; |
| 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.ScmFile; |
| 23 |
import org.apache.maven.scm.ScmResult; |
| 24 |
|
| 25 |
import java.util.List; |
| 26 |
|
| 27 |
/** |
| 28 |
* @author <a href="mailto:[email protected]">Trygve Laugstøl</a> |
| 29 |
* @author Olivier Lamy |
| 30 |
* |
| 31 |
*/ |
| 32 |
public class CheckOutScmResult |
| 33 |
extends ScmResult |
| 34 |
{ |
| 35 |
|
| 36 |
private static final long serialVersionUID = 3345964619749320210L; |
| 37 |
|
| 38 |
private List<ScmFile> checkedOutFiles; |
| 39 |
|
| 40 |
/** |
| 41 |
* @since 1.8 |
| 42 |
*/ |
| 43 |
private String revision; |
| 44 |
|
| 45 |
/** |
| 46 |
* The relative path of the directory of the checked out project in comparison to the checkout directory, or |
| 47 |
* an empty String in case the checkout directory equals the project directory. |
| 48 |
* <p> |
| 49 |
* With most SCMs, this is just an empty String, meaning that the checkout directory equals the project directory. |
| 50 |
* But there are cases (e.g. ClearCase) where within the checkout directory, the directory structure of the |
| 51 |
* SCM system is repeated. E.g. if you check out the project "my/project" to "/some/dir", the project sources |
| 52 |
* are actually checked out to "my/project/some/dir". In this example, relativePathProjectDirectory would |
| 53 |
* contain "my/project". |
| 54 |
*/ |
| 55 |
protected String relativePathProjectDirectory = ""; |
| 56 |
|
| 57 |
public CheckOutScmResult( String commandLine, String providerMessage, String commandOutput, boolean success ) |
| 58 |
{ |
| 59 |
super( commandLine, providerMessage, commandOutput, success ); |
| 60 |
} |
| 61 |
|
| 62 |
public CheckOutScmResult( String commandLine, List<ScmFile> checkedOutFiles ) |
| 63 |
{ |
| 64 |
this( commandLine, null, checkedOutFiles ); |
| 65 |
} |
| 66 |
|
| 67 |
public CheckOutScmResult( String commandLine, String revision, List<ScmFile> checkedOutFiles ) |
| 68 |
{ |
| 69 |
super( commandLine, null, null, true ); |
| 70 |
|
| 71 |
this.revision = revision; |
| 72 |
|
| 73 |
this.checkedOutFiles = checkedOutFiles; |
| 74 |
} |
| 75 |
|
| 76 |
public CheckOutScmResult( String commandLine, List<ScmFile> checkedOutFiles, String relativePathProjectDirectory ) |
| 77 |
{ |
| 78 |
this( commandLine, null, checkedOutFiles ); |
| 79 |
if ( relativePathProjectDirectory != null ) |
| 80 |
{ |
| 81 |
this.relativePathProjectDirectory = relativePathProjectDirectory; |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
public CheckOutScmResult( String commandLine, String revision, List<ScmFile> checkedOutFiles, |
| 86 |
String relativePathProjectDirectory ) |
| 87 |
{ |
| 88 |
this( commandLine, revision, checkedOutFiles ); |
| 89 |
if ( relativePathProjectDirectory != null ) |
| 90 |
{ |
| 91 |
this.relativePathProjectDirectory = relativePathProjectDirectory; |
| 92 |
} |
| 93 |
|
| 94 |
} |
| 95 |
|
| 96 |
public CheckOutScmResult( List<ScmFile> checkedOutFiles, ScmResult result ) |
| 97 |
{ |
| 98 |
super( result ); |
| 99 |
|
| 100 |
this.checkedOutFiles = checkedOutFiles; |
| 101 |
} |
| 102 |
|
| 103 |
public List<ScmFile> getCheckedOutFiles() |
| 104 |
{ |
| 105 |
return checkedOutFiles; |
| 106 |
} |
| 107 |
|
| 108 |
/** |
| 109 |
* @return the contents of {@link #relativePathProjectDirectory} |
| 110 |
* @see #relativePathProjectDirectory |
| 111 |
*/ |
| 112 |
public String getRelativePathProjectDirectory() |
| 113 |
{ |
| 114 |
return relativePathProjectDirectory; |
| 115 |
} |
| 116 |
|
| 117 |
/** |
| 118 |
* Checked-out revision. |
| 119 |
* SCM's that have no revision per repository (or branch) should store <code>null</code> here. |
| 120 |
* |
| 121 |
* @return the revision that was checked out. |
| 122 |
* @since 1.8 |
| 123 |
*/ |
| 124 |
public String getRevision() |
| 125 |
{ |
| 126 |
return revision; |
| 127 |
} |
| 128 |
} |