1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.jdbc;
17
18 import javax.sql.DataSource;
19
20 import org.kuali.common.jdbc.context.DatabaseProcessContext;
21 import org.kuali.common.util.LoggerUtils;
22 import org.kuali.common.util.execute.Executable;
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
25 import org.springframework.util.Assert;
26
27 public class ShowConfigExecutable implements Executable {
28
29 private static final Logger logger = LoggerFactory.getLogger(ShowConfigExecutable.class);
30
31 DatabaseProcessContext context;
32 DataSource dataSource;
33 JdbcService service;
34 boolean skip;
35
36 @Override
37 public void execute() {
38 if (skip) {
39 logger.info("Skipping execution");
40 return;
41 }
42
43 Assert.notNull(service, "service is null");
44 Assert.notNull(context, "context is null");
45 Assert.notNull(dataSource, "dataSource is null");
46
47 logger.info("------------------------------------------------------------------------");
48 logger.info("JDBC Configuration");
49 logger.info("------------------------------------------------------------------------");
50 logger.info("Vendor - {}", context.getVendor());
51 logger.info("URL - {}", context.getUrl());
52 logger.info("User - {}", LoggerUtils.getUsername(context.getUsername()));
53 logger.info("Password - {}", LoggerUtils.getPassword(context.getUsername(), context.getPassword()));
54 logger.info("DBA URL - {}", context.getDbaUrl());
55 logger.info("DBA User - {}", LoggerUtils.getUsername(context.getDbaUsername()));
56 logger.info("DBA Password - {}", LoggerUtils.getPassword(context.getDbaUsername(), context.getDbaPassword()));
57 logger.info("Driver - {}", context.getDriver());
58 logger.info("SQL Encoding - {}", context.getEncoding());
59
60 JdbcMetaData metadata = service.getJdbcMetaData(dataSource);
61 logger.info("Product Name - {}", metadata.getDatabaseProductName());
62 logger.info("Product Version - {}", metadata.getDatabaseProductVersion());
63 logger.info("Driver Name - {}", metadata.getDriverName());
64 logger.info("Driver Version - {}", metadata.getDriverVersion());
65 logger.info("------------------------------------------------------------------------");
66 }
67
68 public DatabaseProcessContext getContext() {
69 return context;
70 }
71
72 public void setContext(DatabaseProcessContext context) {
73 this.context = context;
74 }
75
76 public DataSource getDataSource() {
77 return dataSource;
78 }
79
80 public void setDataSource(DataSource dataSource) {
81 this.dataSource = dataSource;
82 }
83
84 public JdbcService getService() {
85 return service;
86 }
87
88 public void setService(JdbcService service) {
89 this.service = service;
90 }
91
92 public boolean isSkip() {
93 return skip;
94 }
95
96 public void setSkip(boolean skip) {
97 this.skip = skip;
98 }
99
100 }