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 java.io.Serializable; 23 24 /** 25 * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a> 26 * 27 */ 28 public class ScmResult 29 implements Serializable 30 { 31 private static final long serialVersionUID = 7037918334820621525L; 32 33 private final boolean success; 34 35 private final String providerMessage; 36 37 private final String commandOutput; 38 39 private final String commandLine; 40 41 /** 42 * Copy constructor. 43 * <p/> 44 * Typically used from derived classes when wrapping a ScmResult 45 * into a specific type eg. AddScmResult 46 * 47 * @param scmResult not null 48 */ 49 public ScmResult( ScmResult scmResult ) 50 { 51 this.commandLine = scmResult.commandLine; 52 53 this.providerMessage = scmResult.providerMessage; 54 55 this.commandOutput = scmResult.commandOutput; 56 57 this.success = scmResult.success; 58 } 59 60 /** 61 * ScmResult contructor. 62 * 63 * @param commandLine The provider specific command line used 64 * @param providerMessage The provider message 65 * @param commandOutput The command output of the scm tool 66 * @param success True if the command is in success 67 */ 68 public ScmResult( String commandLine, String providerMessage, String commandOutput, boolean success ) 69 { 70 this.commandLine = commandLine; 71 72 this.providerMessage = providerMessage; 73 74 this.commandOutput = commandOutput; 75 76 this.success = success; 77 } 78 79 /** 80 * @return True if the command was in success 81 */ 82 public boolean isSuccess() 83 { 84 return success; 85 } 86 87 /** 88 * @return A message from the provider. On success this would typically be null or 89 * an empty string. On failure it would be the error message from the provider 90 */ 91 public String getProviderMessage() 92 { 93 return providerMessage; 94 } 95 96 /** 97 * @return Output from Std.Out from the provider during execution 98 * of the command that resulted in this 99 */ 100 public String getCommandOutput() 101 { 102 return commandOutput; 103 } 104 105 /** 106 * @return The actual provider specific command that resulted in this 107 */ 108 public String getCommandLine() 109 { 110 return commandLine; 111 } 112 }