View Javadoc

1   /**
2    * Copyright 2011 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.student.deploy.spring;
17  
18  import java.util.ArrayList;
19  import java.util.List;
20  
21  import org.kuali.common.impex.spring.ProjectStagingConfig;
22  import org.kuali.common.util.execute.Executable;
23  import org.kuali.common.util.execute.ExecutablesExecutable;
24  import org.kuali.common.util.scm.ScmProjectConfig;
25  import org.kuali.common.util.spring.ExecutableConfig;
26  import org.springframework.beans.factory.annotation.Autowired;
27  import org.springframework.context.annotation.Configuration;
28  import org.springframework.context.annotation.Import;
29  
30  @Configuration
31  @Import({ ProjectStagingConfig.class, ScmProjectConfig.class })
32  public class ScmUpdateExecutableConfig extends ExecutableConfig {
33  
34  	@Autowired
35  	ProjectStagingConfig projectStagingConfig;
36  
37  	@Autowired
38  	ScmProjectConfig scmProjectConfig;
39  
40  	@Override
41  	protected Executable getExecutable() {
42  		// Add the executables that will get run (in the correct order)
43  		List<Executable> executables = new ArrayList<Executable>();
44  
45  		// Copy schema files
46  		executables.add(projectStagingConfig.dumpSchemaFilesExecutable());
47  
48  		// Copy MPX files
49  		executables.add(projectStagingConfig.copyProjectDataFilesExecutable());
50  
51  		// Update SCM by adding, deleting, committing files as needed
52  		executables.add(scmProjectConfig.projectScmConfigUpdateScmExecutable());
53  
54  		// Setup an executable that will execute things in the right order
55  		return new ExecutablesExecutable(executables);
56  	}
57  
58  }