com.atlassian.bamboo.plugin
Class BambooPluginUtils

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

public class BambooPluginUtils
extends Object


Nested Class Summary
static class BambooPluginUtils.Callable<V>
           
static class BambooPluginUtils.NoThrowCallable<V>
           
static class BambooPluginUtils.Runnable
           
 
Field Summary
static String ARTIFACT_DOWNLOAD_PLUGIN_KEY
          Deprecated. use BambooPluginKeys.ARTIFACT_DOWNLOAD_PLUGIN_KEY
static String ARTIFACT_DOWNLOAD_TASK_MODULE_KEY
          Deprecated. use BambooPluginKeys.ARTIFACT_DOWNLOAD_TASK_MODULE_KEY
static String BAMBOO_APPLICATION_KEY
           
static String BAMBOO_REMOTE_AGENT_APPLICATION_KEY
          Deprecated. use BambooPluginKeys.BAMBOO_REMOTE_AGENT_APPLICATION_KEY
static String CLEAN_WORKINGDIR_TASK_MODULE_KEY
          Deprecated. use BambooPluginKeys.CLEAN_WORKINGDIR_TASK_MODULE_KEY
static String CVS_REPOSITORY_PLUGIN_KEY
          Deprecated. use BambooPluginKeys.CVS_REPOSITORY_PLUGIN_KEY
static String GIT_REPOSITORY_PLUGIN_KEY
          Deprecated. use BambooPluginKeys.GIT_REPOSITORY_PLUGIN_KEY
static String PLUGIN_DESCRIPTOR_FILENAME
           
static String SCRIPT_BUILDER_TASK_PLUGIN_KEY
          Deprecated. use BambooPluginKeys.SCRIPT_BUILDER_TASK_PLUGIN_KEY
static String SVN_REPOSITORY_PLUGIN_KEY
          Deprecated. use BambooPluginKeys.SVN_REPOSITORY_PLUGIN_KEY
static String TASK_VCS_CHECKOUT_PLUGIN_KEY
          Deprecated. use BambooPluginKeys.TASK_VCS_CHECKOUT_PLUGIN_KEY
 
Method Summary
static
<T> T
callUnsafeCode(BambooPluginUtils.Callable<T> callable)
          Calls call() method on the supplied callable.
static Iterable<TaskDefinition> filterEnabledTasks(BuildContext buildContext, String pluginKey)
           
static
<T extends TaskDefinition>
Iterable<T>
filterEnabledTasks(Iterable<T> taskDefinitions, String pluginKey)
           
static Iterable<TaskDefinition> filterTasks(BuildContext buildContext, String pluginKey)
           
static Iterable<TaskDefinition> filterTasks(ImmutableJob job, String pluginKey)
           
static
<T extends TaskDefinition>
Iterable<T>
filterTasks(Iterable<T> taskDefinitions, com.google.common.base.Predicate<TaskDefinition>... predicates)
           
static Iterable<TaskDefinition> filterTasks(Iterable<TaskDefinition> taskDefinitions, String pluginKey)
           
static com.google.common.collect.Ordering<com.atlassian.plugin.ModuleDescriptor<?>> getModuleDescriptorNameOrdering()
           
static void handleError(String errorMessage, Error error)
          Deprecated. since 4.3 you should probably use callUnsafeCode(com.atlassian.bamboo.plugin.BambooPluginUtils.Callable) instead
static
<T> com.google.common.base.Function<com.atlassian.plugin.ModuleDescriptor<T>,T>
instantiateModule()
           
static com.google.common.base.Predicate<TaskProcessCommandDecoratorModuleDescriptor> isTaskProcessCommandDecoratorApplicableTo(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 String BAMBOO_APPLICATION_KEY
See Also:
Constant Field Values

BAMBOO_REMOTE_AGENT_APPLICATION_KEY

@Deprecated
public static final String BAMBOO_REMOTE_AGENT_APPLICATION_KEY
Deprecated. use BambooPluginKeys.BAMBOO_REMOTE_AGENT_APPLICATION_KEY
Since:
5.9
See Also:
Constant Field Values

PLUGIN_DESCRIPTOR_FILENAME

public static final String PLUGIN_DESCRIPTOR_FILENAME
See Also:
Constant Field Values

TASK_VCS_CHECKOUT_PLUGIN_KEY

@Deprecated
public static final String TASK_VCS_CHECKOUT_PLUGIN_KEY
Deprecated. use BambooPluginKeys.TASK_VCS_CHECKOUT_PLUGIN_KEY
Since:
5.9
See Also:
Constant Field Values

SVN_REPOSITORY_PLUGIN_KEY

@Deprecated
public static final String SVN_REPOSITORY_PLUGIN_KEY
Deprecated. use BambooPluginKeys.SVN_REPOSITORY_PLUGIN_KEY
Since:
5.9
See Also:
Constant Field Values

CVS_REPOSITORY_PLUGIN_KEY

@Deprecated
public static final String CVS_REPOSITORY_PLUGIN_KEY
Deprecated. use BambooPluginKeys.CVS_REPOSITORY_PLUGIN_KEY
Since:
5.9
See Also:
Constant Field Values

GIT_REPOSITORY_PLUGIN_KEY

@Deprecated
public static final String GIT_REPOSITORY_PLUGIN_KEY
Deprecated. use BambooPluginKeys.GIT_REPOSITORY_PLUGIN_KEY
Since:
5.9
See Also:
Constant Field Values

ARTIFACT_DOWNLOAD_PLUGIN_KEY

@Deprecated
public static final String ARTIFACT_DOWNLOAD_PLUGIN_KEY
Deprecated. use BambooPluginKeys.ARTIFACT_DOWNLOAD_PLUGIN_KEY
Since:
5.9
See Also:
Constant Field Values

CLEAN_WORKINGDIR_TASK_MODULE_KEY

@Deprecated
public static final String CLEAN_WORKINGDIR_TASK_MODULE_KEY
Deprecated. use BambooPluginKeys.CLEAN_WORKINGDIR_TASK_MODULE_KEY
Since:
5.9
See Also:
Constant Field Values

ARTIFACT_DOWNLOAD_TASK_MODULE_KEY

@Deprecated
public static final String ARTIFACT_DOWNLOAD_TASK_MODULE_KEY
Deprecated. use BambooPluginKeys.ARTIFACT_DOWNLOAD_TASK_MODULE_KEY
Since:
5.9
See Also:
Constant Field Values

SCRIPT_BUILDER_TASK_PLUGIN_KEY

@Deprecated
public static final String SCRIPT_BUILDER_TASK_PLUGIN_KEY
Deprecated. use BambooPluginKeys.SCRIPT_BUILDER_TASK_PLUGIN_KEY
Since:
5.9
See Also:
Constant Field Values
Method Detail

handleError

@Deprecated
public static void handleError(@Nullable
                                          String errorMessage,
                                          Error error)
Deprecated. since 4.3 you should probably use callUnsafeCode(com.atlassian.bamboo.plugin.BambooPluginUtils.Callable) 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.Callable<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
                                                                                                                                      String pluginKey)

getModuleDescriptorNameOrdering

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

filterTasks

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

filterEnabledTasks

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

filterTasks

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

filterTasks

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

filterEnabledTasks

public static <T extends TaskDefinition> Iterable<T> filterEnabledTasks(Iterable<T> taskDefinitions,
                                                                        String pluginKey)

filterTasks

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


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.