001/** 002 * Copyright 2010-2014 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.common.util.service; 017 018import java.io.File; 019import java.util.ArrayList; 020import java.util.Arrays; 021import java.util.List; 022 023import org.kuali.common.util.Assert; 024import org.kuali.common.util.CollectionUtils; 025import org.kuali.common.util.LocationUtils; 026 027/** 028 * @deprecated 029 */ 030@Deprecated 031public class SvnService extends DefaultExecService implements ScmService { 032 033 private static final String SVN = "svn"; 034 035 @Override 036 public void version() { 037 executeAndValidate(SVN, Arrays.asList("--version")); 038 } 039 040 @Override 041 public void add(List<File> paths) { 042 if (CollectionUtils.isEmpty(paths)) { 043 // Nothing to do 044 return; 045 } 046 String command = "add"; 047 List<String> cpaths = LocationUtils.getCanonicalPaths(paths); 048 List<String> options = Arrays.asList("--force", "--parents", "--depth", "infinity"); 049 050 List<String> arguments = new ArrayList<String>(); 051 arguments.add(command); 052 arguments.addAll(cpaths); 053 arguments.addAll(options); 054 055 executeAndValidate(SVN, arguments); 056 } 057 058 @Override 059 public void delete(List<File> paths) { 060 if (CollectionUtils.isEmpty(paths)) { 061 // Nothing to do 062 return; 063 } 064 String command = "delete"; 065 List<String> cpaths = LocationUtils.getCanonicalPaths(paths); 066 List<String> options = Arrays.asList("--force"); 067 068 List<String> arguments = new ArrayList<String>(); 069 arguments.add(command); 070 arguments.addAll(cpaths); 071 arguments.addAll(options); 072 073 executeAndValidate(SVN, arguments); 074 } 075 076 @Override 077 public void commit(List<File> paths, String message) { 078 if (CollectionUtils.isEmpty(paths)) { 079 // Nothing to do 080 return; 081 } 082 Assert.notBlank(message, "Commit message is blank"); 083 String command = "commit"; 084 List<String> cpaths = LocationUtils.getCanonicalPaths(paths); 085 List<String> options = Arrays.asList("--depth", "infinity", "--message", message); 086 087 List<String> arguments = new ArrayList<String>(); 088 arguments.add(command); 089 arguments.addAll(cpaths); 090 arguments.addAll(options); 091 092 executeAndValidate(SVN, arguments); 093 } 094 095}