001/*
002 * Copyright 2005-2007 The Kuali Foundation
003 *
004 *
005 * Licensed under the Educational Community License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.opensource.org/licenses/ecl2.php
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.kualigan.tools.ant.tasks;
018
019import org.apache.tools.ant.BuildException;
020import org.apache.tools.ant.DirectoryScanner;
021import org.apache.tools.ant.Task;
022import org.apache.tools.ant.types.FileSet;
023
024import static org.apache.tools.ant.Project.MSG_DEBUG;
025
026
027/**
028 * Sets up conventional liquibase properties
029 *
030 * @author Leo Przybylski (przybyls@arizona.edu)
031 */
032public class LiquibaseSetup extends Task {
033    private String rdbmsConfigId;
034
035    /**
036     * Gets the value of rdbmsConfigId
037     *
038     * @return the value of rdbmsConfigId
039     */
040    public final String getRdbmsConfigId() {
041        return this.rdbmsConfigId;
042    }
043
044    /**
045     * Sets the value of rdbmsConfigId
046     *
047     * @param argRdbmsConfigId Value to assign to this.rdbmsConfigId
048     */
049    public final void setRdbmsConfigId(final String argRdbmsConfigId) {
050        this.rdbmsConfigId = argRdbmsConfigId;
051    }    
052
053    public void execute() {
054        final RdbmsConfig config = (RdbmsConfig) getProject().getReference(getRdbmsConfigId());
055        getProject().setProperty("lb.database.url", config.getUrl());
056        getProject().setProperty("lb.database.username", config.getUsername());
057        getProject().setProperty("lb.database.password", config.getPassword());
058    }
059}