com.atlassian.bamboo.plugin
Class BambooPluginUtils

java.lang.Object
  extended by com.atlassian.bamboo.plugin.BambooPluginUtils

public class BambooPluginUtils
extends java.lang.Object


Nested Class Summary
static class BambooPluginUtils.NoThrowCallable<V>
           
static class BambooPluginUtils.Runnable
           
 
Field Summary
static java.lang.String ARTIFACT_DOWNLOAD_PLUGIN_KEY
           
static java.lang.String ARTIFACT_DOWNLOAD_TASK_MODULE_KEY
           
static java.lang.String BAMBOO_APPLICATION_KEY
           
static java.lang.String BAMBOO_REMOTE_AGENT_APPLICATION_KEY
           
static java.lang.String CLEAN_WORKINGDIR_TASK_MODULE_KEY
           
static java.lang.String PLUGIN_DESCRIPTOR_FILENAME
           
static java.lang.String SCRIPT_BUILDER_TASK_PLUGIN_KEY
           
static java.lang.String SVN_REPOSITORY_PLUGIN_KEY
           
static java.lang.String TASK_VCS_CHECKOUT_PLUGIN_KEY
           
 
Method Summary
static
<T> T
callUnsafeCode(BambooPluginUtils.NoThrowCallable<T> callable)
          Calls call() method on the supplied callable.
static java.lang.Iterable<TaskDefinition> filterEnabledTasks(BuildContext buildContext, java.lang.String pluginKey)
           
static java.lang.Iterable<TaskDefinition> filterEnabledTasks(java.lang.Iterable<TaskDefinition> taskDefinitions, java.lang.String pluginKey)
           
static java.lang.Iterable<TaskDefinition> filterTasks(BuildContext buildContext, java.lang.String pluginKey)
           
static java.lang.Iterable<TaskDefinition> filterTasks(ImmutableJob job, java.lang.String pluginKey)
           
static java.lang.Iterable<TaskDefinition> filterTasks(java.lang.Iterable<TaskDefinition> taskDefinitions, com.google.common.base.Predicate<TaskDefinition>... predicates)
           
static java.lang.Iterable<TaskDefinition> filterTasks(java.lang.Iterable<TaskDefinition> taskDefinitions, java.lang.String pluginKey)
           
static com.google.common.collect.Ordering<com.atlassian.plugin.ModuleDescriptor<?>> getModuleDescriptorNameOrdering()
           
static void handleError(java.lang.String errorMessage, java.lang.Error error)
          Deprecated. since 4.3 you should probably use $callUnsafeCode(com.atlassian.bamboo.plugin.BambooPluginUtils.NoThrowCallable) instead
static
<T> com.google.common.base.Function<com.atlassian.plugin.ModuleDescriptor<T>,T>
instantiateModule()
           
static com.google.common.base.Predicate<TaskProcessCommandDecoratorModuleDescriptor> isTaskProcessCommandDecoratorApplicableTo(java.lang.String pluginKey)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BAMBOO_APPLICATION_KEY

public static final java.lang.String BAMBOO_APPLICATION_KEY
See Also:
Constant Field Values

BAMBOO_REMOTE_AGENT_APPLICATION_KEY

public static final java.lang.String BAMBOO_REMOTE_AGENT_APPLICATION_KEY
See Also:
Constant Field Values

PLUGIN_DESCRIPTOR_FILENAME

public static final java.lang.String PLUGIN_DESCRIPTOR_FILENAME
See Also:
Constant Field Values

TASK_VCS_CHECKOUT_PLUGIN_KEY

public static final java.lang.String TASK_VCS_CHECKOUT_PLUGIN_KEY
See Also:
Constant Field Values

SVN_REPOSITORY_PLUGIN_KEY

public static final java.lang.String SVN_REPOSITORY_PLUGIN_KEY
See Also:
Constant Field Values

ARTIFACT_DOWNLOAD_PLUGIN_KEY

public static final java.lang.String ARTIFACT_DOWNLOAD_PLUGIN_KEY
See Also:
Constant Field Values

CLEAN_WORKINGDIR_TASK_MODULE_KEY

public static final java.lang.String CLEAN_WORKINGDIR_TASK_MODULE_KEY
See Also:
Constant Field Values

ARTIFACT_DOWNLOAD_TASK_MODULE_KEY

public static final java.lang.String ARTIFACT_DOWNLOAD_TASK_MODULE_KEY
See Also:
Constant Field Values

SCRIPT_BUILDER_TASK_PLUGIN_KEY

public static final java.lang.String SCRIPT_BUILDER_TASK_PLUGIN_KEY
See Also:
Constant Field Values
Method Detail

handleError

@Deprecated
public static void handleError(java.lang.String errorMessage,
                                          java.lang.Error error)
Deprecated. since 4.3 you should probably use $callUnsafeCode(com.atlassian.bamboo.plugin.BambooPluginUtils.NoThrowCallable) instead

Checks whether an error is critical and should be thrown further, or whether to just log the message and continue the execution. Use this method to handle exceptions thrown within Plugins, as we don't want them to bork our configuration pages nor damage normal Bamboo behaviour (except for the critical errors, like OOM and similar).

Parameters:
errorMessage - Message to be displayed in logs.
error - Error causing the trouble.

callUnsafeCode

@Nullable
public static <T> T callUnsafeCode(BambooPluginUtils.NoThrowCallable<T> callable)
Calls call() method on the supplied callable. RuntimeExceptions are logged and swallowed. For handling of errors, see $handleError(String, Error)

Type Parameters:
T -
Parameters:
callable - a callable wrapping unsafe plugin calls
Returns:

instantiateModule

public static <T> com.google.common.base.Function<com.atlassian.plugin.ModuleDescriptor<T>,T> instantiateModule()

isTaskProcessCommandDecoratorApplicableTo

public static com.google.common.base.Predicate<TaskProcessCommandDecoratorModuleDescriptor> isTaskProcessCommandDecoratorApplicableTo(@NotNull
                                                                                                                                      java.lang.String pluginKey)

getModuleDescriptorNameOrdering

@NotNull
public static com.google.common.collect.Ordering<com.atlassian.plugin.ModuleDescriptor<?>> getModuleDescriptorNameOrdering()

filterTasks

public static java.lang.Iterable<TaskDefinition> filterTasks(BuildContext buildContext,
                                                             java.lang.String pluginKey)

filterEnabledTasks

public static java.lang.Iterable<TaskDefinition> filterEnabledTasks(BuildContext buildContext,
                                                                    java.lang.String pluginKey)

filterTasks

public static java.lang.Iterable<TaskDefinition> filterTasks(java.lang.Iterable<TaskDefinition> taskDefinitions,
                                                             java.lang.String pluginKey)

filterTasks

public static java.lang.Iterable<TaskDefinition> filterTasks(java.lang.Iterable<TaskDefinition> taskDefinitions,
                                                             com.google.common.base.Predicate<TaskDefinition>... predicates)

filterEnabledTasks

public static java.lang.Iterable<TaskDefinition> filterEnabledTasks(java.lang.Iterable<TaskDefinition> taskDefinitions,
                                                                    java.lang.String pluginKey)

filterTasks

public static java.lang.Iterable<TaskDefinition> filterTasks(ImmutableJob job,
                                                             java.lang.String pluginKey)


Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.