001 /**
002 * Copyright 2010-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.common.jdbc;
017
018 import javax.sql.DataSource;
019
020 import org.kuali.common.jdbc.context.DatabaseProcessContext;
021 import org.kuali.common.util.LoggerUtils;
022 import org.kuali.common.util.execute.Executable;
023 import org.slf4j.Logger;
024 import org.slf4j.LoggerFactory;
025 import org.springframework.util.Assert;
026
027 /**
028 * @deprecated
029 */
030 @Deprecated
031 public class ShowDbaConfigExecutable implements Executable {
032
033 private static final Logger logger = LoggerFactory.getLogger(ShowDbaConfigExecutable.class);
034
035 DatabaseProcessContext context;
036 DataSource dataSource;
037 JdbcService service;
038 boolean skip;
039
040 @Override
041 public void execute() {
042 if (skip) {
043 logger.info("Skipping execution");
044 return;
045 }
046
047 Assert.notNull(service, "service is null");
048 Assert.notNull(context, "context is null");
049 Assert.notNull(dataSource, "dataSource is null");
050
051 logger.info("------------------------------------------------------------------------");
052 logger.info("JDBC Configuration");
053 logger.info("------------------------------------------------------------------------");
054 logger.info("Vendor - {}", context.getVendor());
055 logger.info("URL - {}", context.getUrl());
056 logger.info("Schema - {}", context.getSchema());
057 logger.info("User - {}", LoggerUtils.getUsername(context.getUsername()));
058 logger.info("Password - {}", LoggerUtils.getPassword(context.getUsername(), context.getPassword()));
059 logger.info("DBA URL - {}", context.getDbaUrl());
060 logger.info("DBA User - {}", LoggerUtils.getUsername(context.getDbaUsername()));
061 logger.info("DBA Password - {}", LoggerUtils.getPassword(context.getDbaUsername(), context.getDbaPassword()));
062 logger.info("Driver - {}", context.getDriver());
063 logger.info("SQL Encoding - {}", context.getEncoding());
064 // Establish a connection to the db to extract more detailed info
065 JdbcMetaData metadata = service.getJdbcMetaData(dataSource);
066 logger.info("Product Name - {}", metadata.getDatabaseProductName());
067 logger.info("Product Version - {}", metadata.getDatabaseProductVersion());
068 logger.info("Driver Name - {}", metadata.getDriverName());
069 logger.info("Driver Version - {}", metadata.getDriverVersion());
070 logger.info("------------------------------------------------------------------------");
071 }
072
073 public DatabaseProcessContext getContext() {
074 return context;
075 }
076
077 public void setContext(DatabaseProcessContext context) {
078 this.context = context;
079 }
080
081 public DataSource getDataSource() {
082 return dataSource;
083 }
084
085 public void setDataSource(DataSource dataSource) {
086 this.dataSource = dataSource;
087 }
088
089 public JdbcService getService() {
090 return service;
091 }
092
093 public void setService(JdbcService service) {
094 this.service = service;
095 }
096
097 public boolean isSkip() {
098 return skip;
099 }
100
101 public void setSkip(boolean skip) {
102 this.skip = skip;
103 }
104
105 }