View Javadoc

1   package com.atlassian.plugin.webresource;
2   
3   import com.atlassian.plugin.util.PluginUtils;
4   
5   import java.util.List;
6   import java.util.Collections;
7   
8   /**
9    * Default configuration for the plugin resource locator, for those applications that do not want to perform
10   * any super-batching.
11   */
12  public class DefaultResourceBatchingConfiguration implements ResourceBatchingConfiguration
13  {
14      public static final String PLUGIN_WEBRESOURCE_BATCHING_OFF = "plugin.webresource.batching.off";
15      public static final String PLUGIN_WEBRESOURCE_TRY_CATCH_WRAPPING = "plugin.webresource.trycatch.wrapping";
16      public static final String PLUGIN_WEB_RESOURCE_BATCH_CONTENT_TRACKING = "plugin.webresource.batch.content.tracking";
17  
18      public boolean isSuperBatchingEnabled()
19      {
20          return false;
21      }
22  
23      public List<String> getSuperBatchModuleCompleteKeys()
24      {
25          return Collections.emptyList();
26      }
27  
28      public boolean isContextBatchingEnabled()
29      {
30          return false;
31      }
32  
33      public boolean isPluginWebResourceBatchingEnabled()
34      {
35          final String explicitSetting = System.getProperty(PLUGIN_WEBRESOURCE_BATCHING_OFF);
36          if (explicitSetting != null)
37          {
38              return !Boolean.parseBoolean(explicitSetting);
39          }
40          else
41          {
42              return !Boolean.parseBoolean(System.getProperty(PluginUtils.ATLASSIAN_DEV_MODE));
43          }
44      }
45  
46      @Override
47      public boolean isBatchContentTrackingEnabled()
48      {
49          final String trackingSetting = System.getProperty(PLUGIN_WEB_RESOURCE_BATCH_CONTENT_TRACKING);
50          if (trackingSetting != null)
51          {
52              return Boolean.parseBoolean(trackingSetting);
53          }
54          else
55          {
56              return false;
57          }
58      }
59  }