1 package org.kuali.common.deploy.spring;
2
3 import java.util.ArrayList;
4 import java.util.Arrays;
5 import java.util.List;
6
7 import org.kuali.common.deploy.SysAdminExecutable;
8 import org.kuali.common.deploy.channel.spring.DefaultSecureChannelConfig;
9 import org.kuali.common.util.UnixCmds;
10 import org.kuali.common.util.execute.Executable;
11 import org.kuali.common.util.secure.channel.SecureChannel;
12 import org.kuali.common.util.spring.env.EnvironmentService;
13 import org.kuali.common.util.spring.service.SpringServiceConfig;
14 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.context.annotation.Bean;
16 import org.springframework.context.annotation.Configuration;
17 import org.springframework.context.annotation.Import;
18
19 @Configuration
20 @Import({ DefaultSecureChannelConfig.class, SpringServiceConfig.class })
21 public class DefaultSysAdminConfig implements SysAdminConfig {
22
23 @Autowired
24 EnvironmentService env;
25
26 @Autowired
27 SecureChannel channel;
28
29 @Override
30 @Bean
31 public Executable sysAdminExecutable() {
32 boolean skip = env.getBoolean("sysadmin.skip", false);
33 String hostname = env.getString("dns.hostname");
34 UnixCmds cmds = new UnixCmds();
35 List<String> commands = new ArrayList<String>();
36 commands.add(cmds.hostname(hostname));
37 commands.addAll(getCopyToolsJarToJreLibExt());
38 return new SysAdminExecutable(channel, commands, skip);
39 }
40
41
42
43
44 protected List<String> getCopyToolsJarToJreLibExt() {
45 UnixCmds cmds = new UnixCmds();
46
47
48 String jdk6Src = env.getString("jdk6.tools.jar.src");
49 String jdk6Dst = env.getString("jdk6.tools.jar.dst");
50 String jdk6Cmd = cmds.cp(jdk6Src, jdk6Dst, true);
51
52
53 String jdk7Src = env.getString("jdk7.tools.jar.src");
54 String jdk7Dst = env.getString("jdk7.tools.jar.dst");
55 String jdk7Cmd = cmds.cp(jdk7Src, jdk7Dst, true);
56
57 return Arrays.asList(jdk6Cmd, jdk7Cmd);
58
59 }
60
61 }