1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.jdbc.show;
17
18 import javax.sql.DataSource;
19
20 import org.kuali.common.jdbc.model.context.DatabaseProcessContext;
21 import org.kuali.common.jdbc.service.JdbcService;
22 import org.kuali.common.util.Assert;
23 import org.kuali.common.util.execute.Executable;
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
26
27 public final class ShowDbaConfigExecutable implements Executable {
28
29 private static final Logger logger = LoggerFactory.getLogger(ShowDbaConfigExecutable.class);
30
31 public static final boolean DEFAULT_SKIP = false;
32
33 public ShowDbaConfigExecutable(DatabaseProcessContext context, DataSource dataSource, JdbcService service) {
34 this(context, dataSource, service, DEFAULT_SKIP);
35 }
36
37 public ShowDbaConfigExecutable(DatabaseProcessContext context, DataSource dataSource, JdbcService service, boolean skip) {
38 Assert.noNulls(context, dataSource, service);
39 this.context = context;
40 this.dataSource = dataSource;
41 this.service = service;
42 this.skip = skip;
43 }
44
45 private final DatabaseProcessContext context;
46 private final DataSource dataSource;
47 private final JdbcService service;
48 private final boolean skip;
49
50 @Override
51 public void execute() {
52
53 if (skip) {
54 return;
55 }
56
57 ShowUtils.showOpen(logger, context);
58 ShowUtils.showDba(logger, context.getConnections().getDba());
59 ShowUtils.showClose(logger, context, service, dataSource);
60 }
61
62 public DatabaseProcessContext getContext() {
63 return context;
64 }
65
66 public DataSource getDataSource() {
67 return dataSource;
68 }
69
70 public JdbcService getService() {
71 return service;
72 }
73
74 public boolean isSkip() {
75 return skip;
76 }
77
78 }