All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openscm.kundo.plugins.EchoDelegate.groovy Maven / Gradle / Ivy

The newest version!
package org.openscm.kundo.plugins

/*
 * Copyright (C) 2008 The Ultimate People Company Ltd ("UPCO").
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import org.openscm.kundo.plugins.context.BuildContext

/**
 * Simple Echo Delegate
 * @author Paul Clifford
 * @version 1.0.0
 * 
 * Description: A simple Echo Delegate that displays a message.
 * 
 * 

The echo plugin displays a message contained in a property, the property is defined * in either the plugin's plugin.properties file or the project's build.properties * file. Properties defined in the project's build.properties file override the default values. * Property default values are specified in the plugin's plugin.properties file.

* * *

These properties are automatically injected into the plugin at runtime. * This is done by the exposing of setter methods for variables mimicking the * name of the . separated ant property but replacing the dots with uppercase * letters resulting in a camelCase variable name.

* * @see #setMessage( String ) * @see #setOutputFile( String ) */ /* * @ant-target doEcho */ class EchoDelegate extends AbstractPluginTargetDelegate { /* * A message to be displayed on the screen * @ant-property-name echo.message */ String message /* * A file name that will have a message written to it * @ant-property-name echo.output.file */ String outputFile /** * Constructor sets ant and buildContext instances in super class * @param ant AntBuilder instance * @param buildContext BuildContext instance */ EchoDelegate( AntBuilder ant, BuildContext buildContext ){ super( ant, buildContext) } /** * Setter method for member variable message * @param message String representation of a message to print */ void setMessage( String message ){ this.message = message } /** * Setter method for member variable outputFile * @param outputFile String representation of a file name to output a message to */ void setOutputFile( String outputFile ){ this.outputFile = outputFile } /** * Private method for displaying the message * outputs the value in the message member variable, * also writes that value to the file name in the * outputFile member variable. */ private void echo() { ant.echo( message:message, level:"info" ) ant.echo( message:message, level:"info", file:outputFile ) } /** * Implementation of abstract method from AbstractPluginTargetDelegate * to hold assertions that all global and local properties are available to the plugin. * This method is automatically called prior to execution. */ void doCheck(){ assert message != null assert outputFile != null } /** * Implementation of abstract method from AbstractPluginTargetDelegate * this method is automatically called. */ void doExecute(){ echo() } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy