View Javadoc

1   /**
2    * Copyright 2010-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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  }