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 ShowConfigExecutable implements Executable {
28
29 private static final Logger logger = LoggerFactory.getLogger(ShowConfigExecutable.class);
30 public static final boolean DEFAULT_SKIP = false;
31
32 public ShowConfigExecutable(DatabaseProcessContext context, DataSource dataSource, JdbcService service) {
33 this(context, dataSource, service, DEFAULT_SKIP);
34 }
35
36 public ShowConfigExecutable(DatabaseProcessContext context, DataSource dataSource, JdbcService service, boolean skip) {
37 Assert.noNulls(context, dataSource, service);
38 this.context = context;
39 this.dataSource = dataSource;
40 this.service = service;
41 this.skip = skip;
42 }
43
44 private final DatabaseProcessContext context;
45 private final DataSource dataSource;
46 private final JdbcService service;
47 private final boolean skip;
48
49 @Override
50 public void execute() {
51
52 if (skip) {
53 return;
54 }
55
56 ShowUtils.showOpen(logger, context);
57 ShowUtils.showClose(logger, context, service, dataSource);
58 }
59
60 public DatabaseProcessContext getContext() {
61 return context;
62 }
63
64 public DataSource getDataSource() {
65 return dataSource;
66 }
67
68 public JdbcService getService() {
69 return service;
70 }
71
72 public boolean isSkip() {
73 return skip;
74 }
75
76 }