001package org.apache.maven.scm.provider; 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/** 023 * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a> 024 * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a> 025 * @author <a href="mailto:ChrisGWarp@gmail.com">Chris Graham</a> 026 * 027 */ 028public abstract class ScmProviderRepository 029{ 030 private String user; 031 032 private String password; 033 034 @Deprecated 035 private boolean persistCheckout = false; 036 037 /** 038 * @since 1.4 039 */ 040 private boolean pushChanges = true; 041 042 /** 043 * Some SCMs have the concept of a work item (or task) which may need to be 044 * specified to allow changes to be pushed or delivered to a target. 045 * This allows you to answer the question: For this workItem, what changed? 046 * Auditors have been known to love this... :) 047 * SCMs known to implement this are: 048 * <ul> 049 * <li>IBM Rational Team Concert (workItem) 050 * <li>Microsoft Team Foundation Server (workItem) 051 * <li>IBM Rational ClearQuest Enabled UCM ClearCase (task) 052 * </ul> 053 * There may be others that support this feature. 054 * <P> 055 * These SCMs can be configured to reject a push/deliver unless additional 056 * information (by way of a workItem/task) is supplied. 057 * <P> 058 * This field is only relevant when pushChanges = true. 059 * <P> 060 * It should be noted however, when pushChanges = true, a workItem does not 061 * need to be set, as the need for a workItem may be optional. 062 * 063 * @since 1.9.5 064 */ 065 @Deprecated 066 private String workItem; 067 068 /** 069 * @return The user. 070 */ 071 public String getUser() 072 { 073 return user; 074 } 075 076 /** 077 * Set the user. 078 * 079 * @param user The user 080 */ 081 public void setUser( String user ) 082 { 083 this.user = user; 084 } 085 086 /** 087 * @return The password. 088 */ 089 public String getPassword() 090 { 091 return password; 092 } 093 094 /** 095 * Set the password. 096 * 097 * @param password The user password 098 */ 099 public void setPassword( String password ) 100 { 101 this.password = password; 102 } 103 104 /** 105 * Should distributed changes be pushed to the central repository? 106 * For many distributed SCMs like Git, a change like a commit 107 * is only stored in your local copy of the repository. Pushing 108 * the change allows your to more easily share it with other users. 109 * @return TODO 110 * @since 1.4 111 */ 112 public boolean isPushChanges() 113 { 114 return pushChanges; 115 } 116 117 /** 118 * @since 1.4 119 * @param pushChanges TODO 120 */ 121 public void setPushChanges( boolean pushChanges ) 122 { 123 this.pushChanges = pushChanges; 124 } 125 126 /** 127 * @return The workItem. 128 * @since 1.9.5 129 */ 130 @Deprecated 131 public String getWorkItem() 132 { 133 return workItem; 134 } 135 136 /** 137 * Set the workItem. 138 * 139 * @param workItem The workItem. 140 * @since 1.9.5 141 */ 142 @Deprecated 143 public void setWorkItem( String workItem ) 144 { 145 this.workItem = workItem; 146 } 147 148 /** 149 * Will checkouts using this repository be persisted so they can 150 * be refreshed in the future? This property is of concern to SCMs 151 * like Perforce and Clearcase where the server must track where a 152 * user checks out to. If false, the server entry (clientspec in Perforce 153 * terminology) will be deleted after the checkout is complete so the 154 * files will not be able to be updated. 155 * <p> 156 * This setting can be overriden by using the system property 157 * "maven.scm.persistcheckout" to true. 158 * <p> 159 * The default is false. See SCM-113 for more detail. 160 * @return TODO 161 */ 162 @Deprecated 163 public boolean isPersistCheckout() 164 { 165 String persist = System.getProperty( "maven.scm.persistcheckout" ); 166 if ( persist != null ) 167 { 168 return Boolean.valueOf( persist ).booleanValue(); 169 } 170 return persistCheckout; 171 } 172 173 @Deprecated 174 public void setPersistCheckout( boolean persistCheckout ) 175 { 176 this.persistCheckout = persistCheckout; 177 } 178 179 /** 180 * Get a {@link ScmProviderRepository} that represents the parent folder in the repository. 181 * Useful when the repository does not exist yet and we need to create it from the parent. 182 * 183 * @return the parent repository 184 * @throws UnsupportedOperationException unless overridden by subclass 185 */ 186 public ScmProviderRepository getParent() 187 { 188 throw new UnsupportedOperationException(); 189 } 190 191 /** 192 * Get the relative path between the repository provided as argument and the current repository. 193 * 194 * @param ancestor another repository that should be ancestor of this one 195 * @return the relative path or <code>null</code> if it can't be resolved 196 * @throws UnsupportedOperationException unless overridden by subclass 197 */ 198 public String getRelativePath( ScmProviderRepository ancestor ) 199 { 200 throw new UnsupportedOperationException(); 201 } 202}